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 2021/06/26 16:05:28 UTC

[groovy] branch danielsun/tweak-GROOVY-8947 updated (489fa4e -> 8c30f1e)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch danielsun/tweak-GROOVY-8947
in repository https://gitbox.apache.org/repos/asf/groovy.git.


 discard 489fa4e  GROOVY-10150: Eliminate ambiguities while parsing non-static class creator
     new 8c30f1e  GROOVY-10150: Eliminate ambiguities while parsing non-static class creator

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (489fa4e)
            \
             N -- N -- N   refs/heads/danielsun/tweak-GROOVY-8947 (8c30f1e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/antlr/GroovyParser.g4                              | 18 ++++++------------
 .../org/apache/groovy/parser/antlr4/AstBuilder.java    |  6 +++---
 src/test/groovy/KeywordsInPropertyNamesTest.groovy     |  2 +-
 3 files changed, 10 insertions(+), 16 deletions(-)

[groovy] 01/01: GROOVY-10150: Eliminate ambiguities while parsing non-static class creator

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/tweak-GROOVY-8947
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 8c30f1eac2760c6924552158c483e063486d5605
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Jun 27 00:05:12 2021 +0800

    GROOVY-10150: Eliminate ambiguities while parsing non-static class creator
---
 src/antlr/GroovyParser.g4              | 6 +++---
 src/test/groovy/bugs/Groovy8947.groovy | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index f971d33..07f1fae 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -907,6 +907,9 @@ pathExpression returns [int t]
 pathElement returns [int t]
     :   nls
         (
+            DOT nls NEW creator[1]
+            { $t = 6; }
+        |
             // AT: foo.@bar selects the field (or attribute), not property
             (
                 (   DOT                 // The all-powerful dot.
@@ -921,9 +924,6 @@ pathElement returns [int t]
             )
             namePart
             { $t = 1; }
-        |
-            DOT nls NEW creator[1]
-            { $t = 6; }
 
             // Can always append a block, as foo{bar}
         |   closureOrLambdaExpression
diff --git a/src/test/groovy/bugs/Groovy8947.groovy b/src/test/groovy/bugs/Groovy8947.groovy
index d7f8c6c..f11e565 100644
--- a/src/test/groovy/bugs/Groovy8947.groovy
+++ b/src/test/groovy/bugs/Groovy8947.groovy
@@ -45,6 +45,11 @@ final class Groovy8947 {
             assert 4 == new Computer().new Cpu(4).coreNumber
             assert 4 == Computer.newCpuInstance(4).coreNumber
             assert 0 == new HashSet(new ArrayList()).size()
+            
+            def coreNumber = new Computer().new Cpu(4).coreNumber
+            assert 4 == coreNumber
+            def cpu = new Computer().new Cpu(4)
+            assert 4 == cpu.coreNumber
         '''
     }