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/24 15:48:54 UTC

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

eric-milles commented on a change in pull request #1570:
URL: https://github.com/apache/groovy/pull/1570#discussion_r619675415



##########
File path: src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
##########
@@ -480,8 +480,14 @@ public static boolean isAssignableTo(ClassNode type, ClassNode toBeAssignedTo) {
         return false;
     }
 
-    static boolean isVargs(final Parameter[] parameters) {
+    static boolean isVargs(final Parameter[] parameters, ClassNode[] argumentTypes) {
         if (parameters == null || parameters.length == 0) return false;
+
+        // GROOVY-10056: Inferred parameter type of lambda expression for multi-dimensions array is not correct
+        if (null != argumentTypes && argumentTypes.length == parameters.length && argumentTypes[argumentTypes.length - 1].isArray()) {
+            return false;
+        }
+

Review comment:
       Instead of changing the definition of what is a variadic method, can you change the lastArgMatchesVarg result only?  A method is variadic regardless of the arguments passed.




-- 
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