groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: GROOVY-8641: Cannot qualify path expression with soft keyword
Date Wed, 04 Jul 2018 23:51:31 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 7a1f71157 -> 6018a4e2b


GROOVY-8641: Cannot qualify path expression with soft keyword

(cherry picked from commit 9677e93)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 6018a4e2b9e7a28754f66851ff6929b64e16ed51
Parents: 7a1f711
Author: sunlan <sunlan@apache.org>
Authored: Thu Jul 5 07:47:47 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Jul 5 07:51:26 2018 +0800

----------------------------------------------------------------------
 src/antlr/GroovyParser.g4                       |  4 +++
 .../parser/antlr4/GroovyParserTest.groovy       |  2 ++
 .../test/resources/bugs/BUG-GROOVY-8641.groovy  | 32 ++++++++++++++++++++
 3 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6018a4e2/src/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 879bb50..ffa6c65 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -1178,6 +1178,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/6018a4e2/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 581b1dd..3625c0e 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
@@ -442,5 +442,7 @@ class GroovyParserTest extends GroovyTestCase {
         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/6018a4e2/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
+}


Mime
View raw message