You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2021/04/14 21:03:25 UTC

[groovy] branch GROOVY-10036 created (now 2e3ce52)

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

emilles pushed a change to branch GROOVY-10036
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 2e3ce52  GROOVY-10036: STC: pass explicit type arguments of extension method call

This branch includes the following new commits:

     new 2e3ce52  GROOVY-10036: STC: pass explicit type arguments of extension method call

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.


[groovy] 01/01: GROOVY-10036: STC: pass explicit type arguments of extension method call

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

emilles pushed a commit to branch GROOVY-10036
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 2e3ce52246e06fedb8584aeea2d4078ecb20b04e
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Apr 14 15:53:14 2021 -0500

    GROOVY-10036: STC: pass explicit type arguments of extension method call
---
 .../transform/stc/StaticTypeCheckingVisitor.java      |  2 +-
 src/test/groovy/transform/stc/GenericsSTCTest.groovy  | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

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 e9fc99e..5daab43 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -5255,7 +5255,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
             } else {
                 args.addExpression(arguments);
             }
-            return inferReturnTypeGenerics(receiver, dgm, args);
+            return inferReturnTypeGenerics(receiver, dgm, args, explicitTypeHints);
         }
         Map<GenericsTypeName, GenericsType> resolvedPlaceholders = resolvePlaceHoldersFromDeclaration(receiver, getDeclaringClass(method, arguments), method, method.isStatic());
         resolvePlaceholdersFromExplicitTypeHints(method, explicitTypeHints, resolvedPlaceholders);
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 5e010df..4d4ce4e 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -578,16 +578,27 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
         ''', 'Number'
     }
 
-    // GROOVY-9914
+    // GROOVY-9914, GROOVY-10036
     void testAssignmentShouldWorkForParameterizedMap() {
         assertScript '''
             Map test(Map<String,String> one) {
-              Map<String,Integer> two = one.collectEntries { k,v ->
-                [(k): v.hashCode()]
-              }
+                Map<String,Integer> two = one.collectEntries { k,v ->
+                    [(k): v.hashCode()]
+                }
             }
             assert test(foo:'bar').containsKey('foo')
         '''
+
+        assertScript '''
+            def list = ['foo','bar','baz']
+            @ASTTest(phase=INSTRUCTION_SELECTION, value={
+                def type = node.getNodeMetaData(INFERRED_TYPE)
+                assert type.toString(false) == 'java.util.Map <String, Object>'
+            })
+            def map = list.<String,Object,String>collectEntries {
+                [(it): it.hashCode()]
+            }
+        '''
     }
 
     // GROOVY-9555