Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I think this is a regression bug, because Groovy 4.0.2 compiles the program successfully.
class Foo<T> {} class Test { public static void test() { foo((true) ? new Foo<Boolean>() : new Foo<>()); } public static void foo(Foo<Boolean> x) {} }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 5: [Static type checking] - Cannot call Test#foo(Foo<java.lang.Boolean>) with arguments [Foo<? extends java.lang.Object>] @ line 5, column 5. foo((true) ? new Foo<Boolean>() : new Foo<>()); ^ 1 error
Expected Behaviour
Compile successfully
Tested against master (commit: e183dc8e04a8ca8762e85e21ac3ee0c03138b6e1)
Attachments
Issue Links
- is related to
-
GROOVY-10114 Wrong type argument inference when using the result of ternary operator directly.
- Closed