groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emil...@apache.org
Subject [groovy] branch master updated: minor edits
Date Sun, 22 Dec 2019 19:47:49 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new d51f5aa  minor edits
d51f5aa is described below

commit d51f5aae39b8a897ba04658d8ace4ec4c930643f
Author: Eric Milles <eric.milles@thomsonreuters.com>
AuthorDate: Sun Dec 22 13:47:43 2019 -0600

    minor edits
---
 .../transform/stc/StaticTypeCheckingVisitor.java   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 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 4abb7f3..659597a 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -4312,30 +4312,30 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport
{
         return null;
     }
 
-    private ClassNode inferSAMTypeGenericsInAssignment(final ClassNode samUsage, final MethodNode
sam, final ClassNode closureType, final ClosureExpression closureExpression) {
+    private ClassNode inferSAMTypeGenericsInAssignment(final ClassNode samType, final MethodNode
abstractMethod, final ClassNode closureType, final ClosureExpression closureExpression) {
         // if the sam type or closure type do not provide generics information,
         // we cannot infer anything, thus we simply return the provided samUsage
-        GenericsType[] samGt = samUsage.getGenericsTypes();
-        GenericsType[] closureGt = closureType.getGenericsTypes();
-        if (samGt == null || closureGt == null) return samUsage;
+        GenericsType[] samTypeGenerics = samType.getGenericsTypes();
+        GenericsType[] closureGenerics = closureType.getGenericsTypes();
+        if (samTypeGenerics == null || closureGenerics == null) return samType;
 
         // extract the generics from the return type
         Map<GenericsTypeName, GenericsType> connections = new HashMap<>();
-        extractGenericsConnections(connections, getInferredReturnType(closureExpression),
sam.getReturnType());
+        extractGenericsConnections(connections, getInferredReturnType(closureExpression),
abstractMethod.getReturnType());
 
         // next we get the block parameter types and set the generics
         // information just like before
         // TODO: add vargs handling
         if (closureExpression.isParameterSpecified()) {
             Parameter[] closureParams = closureExpression.getParameters();
-            Parameter[] methodParams = sam.getParameters();
-            for (int i = 0; i < closureParams.length; i++) {
-                ClassNode fromClosure = closureParams[i].getType();
-                ClassNode fromMethod = methodParams[i].getType();
-                extractGenericsConnections(connections, fromClosure, fromMethod);
+            Parameter[] methodParams = abstractMethod.getParameters();
+            for (int i = 0, n = closureParams.length; i < n; i += 1) {
+                ClassNode closureParamType = closureParams[i].getType();
+                ClassNode methodParamType = methodParams[i].getType();
+                extractGenericsConnections(connections, closureParamType, methodParamType);
             }
         }
-        return applyGenericsContext(connections, samUsage.redirect());
+        return applyGenericsContext(connections, samType.redirect());
     }
 
     protected static ClassNode getGroupOperationResultType(final ClassNode a, final ClassNode
b) {


Mime
View raw message