eric-milles commented on code in PR #2415:
URL: https://github.com/apache/groovy/pull/2415#discussion_r3016829805


##########
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java:
##########
@@ -953,8 +953,8 @@ public static List<MethodNode> chooseBestMethod(final 
ClassNode receiver, Collec
 
         // GROOVY-8965: type disjunction
         boolean duckType = receiver instanceof UnionTypeClassNode;
-        if (methods.size() > 1 && !first(methods).isConstructor())
-            methods = removeCovariantsAndInterfaceEquivalents(methods, 
duckType);
+        if (!duckType && methods.size() > 1 && !first(methods).isConstructor())
+            methods = removeCovariantsAndInterfaceEquivalents(methods, false);
 
         if (!duckType && argumentTypes == null) {
             return asList(methods); // GROOVY-11683: no covariants or 
equivalents

Review Comment:
   Can you combine with this block?  
   ```java
           if (!duckType) {
               if (methods.size() > 1 && !first(methods).isConstructor())
                   methods = removeCovariantsAndInterfaceEquivalents(methods, 
false);
               if (argumentTypes == null)
                   return asList(methods); // GROOVY-11683: no covariants or 
equivalents
           }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to