groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: GROOVY-8753: Compiler error in STC: exception in phase 'instruction selection' (closes #786)
Date Sun, 19 Aug 2018 07:06:35 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 4b4a286e0 -> be241758d


GROOVY-8753: Compiler error in STC: exception in phase 'instruction selection' (closes #786)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: be241758dd4169e70fb84d53ab0e4bbc4c180f14
Parents: 4b4a286
Author: Paul King <paulk@asert.com.au>
Authored: Sat Aug 18 15:23:41 2018 +1000
Committer: Paul King <paulk@asert.com.au>
Committed: Sun Aug 19 17:06:21 2018 +1000

----------------------------------------------------------------------
 .../transform/stc/StaticTypeCheckingVisitor.java     |  2 +-
 .../sc/FieldsAndPropertiesStaticCompileTest.groovy   | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/be241758/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index 56dc529..d6590f9 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -499,7 +499,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport
{
                     getterNode = findValidGetter(enclosingClassNode, "is" + suffix);
                 }
                 if (getterNode != null) {
-                    source.setNodeMetaData(StaticTypesMarker.INFERRED_TYPE, getterNode.getReturnType());
+                    source.putNodeMetaData(StaticTypesMarker.INFERRED_TYPE, getterNode.getReturnType());
                     return;
                 }
             }

http://git-wip-us.apache.org/repos/asf/groovy/blob/be241758/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
b/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
index 4bef2c4..330fbb3 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
@@ -781,4 +781,19 @@ import org.codehaus.groovy.transform.sc.ListOfExpressionsExpression
             //println astTrees
         }
     }
+
+    //GROOVY-8753
+    void testPrivateFieldWithPublicGetter() {
+        assertScript '''
+            @groovy.transform.CompileStatic
+            class A {
+               private List<String> fooNames = []
+               public A(Collection<String> names) {
+                  names.each { fooNames << it }
+               }
+               public List<String> getFooNames() { fooNames }
+            }
+            assert new A(['foo1', 'foo2']).fooNames.size() == 2
+        '''
+    }
 }


Mime
View raw message