You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/07/04 23:48:01 UTC

groovy git commit: GROOVY-8641: Cannot qualify path expression with soft keyword

Repository: groovy
Updated Branches:
  refs/heads/master 6eb56ca2d -> 9677e936f


GROOVY-8641: Cannot qualify path expression with soft keyword


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9677e936
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9677e936
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9677e936

Branch: refs/heads/master
Commit: 9677e936fdde5ec0d5c42663e65035f34a0213e2
Parents: 6eb56ca
Author: sunlan <su...@apache.org>
Authored: Thu Jul 5 07:47:47 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Jul 5 07:47:47 2018 +0800

----------------------------------------------------------------------
 src/antlr/GroovyParser.g4                       |  5 +++
 .../parser/antlr4/GroovyParserTest.groovy       |  3 +-
 .../test/resources/bugs/BUG-GROOVY-8641.groovy  | 32 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9677e936/src/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 788626f..e420c15 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -113,6 +113,7 @@ importDeclaration
     :   annotationsOpt IMPORT STATIC? qualifiedName (DOT MUL | AS alias=identifier)?
     ;
 
+
 typeDeclaration
     :   classOrInterfaceModifiersOpt classDeclaration
     ;
@@ -1144,6 +1145,10 @@ identifier
         // if 'static' followed by DOT, we can treat them as identifiers, e.g. static.unused = { -> }
         { DOT == _input.LT(2).getType() }?
         STATIC
+    |   IN
+    |   DEF
+    |   TRAIT
+    |   AS
     ;
 
 builtInType

http://git-wip-us.apache.org/repos/asf/groovy/blob/9677e936/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
index 2384b85..5719656 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
@@ -427,7 +427,8 @@ class GroovyParserTest extends GroovyTestCase {
         doRunAndTestAntlr4('bugs/GROOVY-8228.groovy')
         doRunAndTestAntlr4('bugs/BUG-GROOVY-8311.groovy')
         doRunAndTest('bugs/BUG-GROOVY-8426.groovy')
-        doTest('bugs/BUG-GROOVY-8511.groovy');
+        doTest('bugs/BUG-GROOVY-8511.groovy')
         doRunAndTestAntlr4('bugs/BUG-GROOVY-8613.groovy')
+        doTest('bugs/BUG-GROOVY-8641.groovy')
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/9677e936/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8641.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8641.groovy b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8641.groovy
new file mode 100644
index 0000000..ac4e3ae
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8641.groovy
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+def delegate = new Object() {
+    def getProperty(String name) {
+        println name
+        return this
+    }
+}
+
+delegate.with {
+    in.foo
+    def.foo
+    trait.foo
+    as.foo
+}