paulk-asert commented on code in PR #2415:
URL: https://github.com/apache/groovy/pull/2415#discussion_r3018732133
##########
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:
done
##########
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java:
##########
@@ -965,6 +965,8 @@ public static List<MethodNode> chooseBestMethod(final
ClassNode receiver, Collec
var view = methods;
if (duckType) {
view = methods.stream().filter(m ->
implementsInterfaceOrSubclassOf(rcvr, m.getDeclaringClass())).toList();
+ if (view.size() > 1)
+ view = removeCovariantsAndInterfaceEquivalents(view, true);
Review Comment:
done
--
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]