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.

##########
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:
       I could take a look at this case when I get through GROOVY-10053 and 
GROOVY-10054.  I'm trying to look over all the generics fallout from 4.0a3 as a 
whole.




-- 
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:
us...@infra.apache.org


Reply via email to