You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2021/04/26 00:16:05 UTC

[GitHub] [groovy] danielsun1106 commented on a change in pull request #1571: GROOVY-10056: Inferred parameter type of lambda expression for multi-…

danielsun1106 commented on a change in pull request #1571:
URL: https://github.com/apache/groovy/pull/1571#discussion_r619904458



##########
File path: src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
##########
@@ -5305,10 +5305,7 @@ protected ClassNode inferReturnTypeGenerics(final ClassNode receiver, final Meth
                                             applyGenericsContextToParameterClass(resolvedPlaceholders, paramType));
                         }
                     }
-                    if (isVargs && lastArg && argumentType.isArray()) {
-                        argumentType = argumentType.getComponentType();
-                    }
-                    if (isVargs && lastArg && paramType.isArray()) {
+                    if (isVargs && lastArg && paramType.isArray() && !argumentType.isArray()) {
                         paramType = paramType.getComponentType();
                     }

Review comment:
       As the following code will make `argumentType` and `paramType` non-array type, so `isVargs && lastArg && argumentType.isArray() && paramType.isArray()` will be always `false` IMO.
   
   https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L5297-L5300
   
   Anyway, let me try according to you suggestion.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org