Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
class Foo<X> {} class Test { public static <T extends Foo<Number>> T test() { T x = (T) null; T y = (true) ? x : (T) null; y } }
Actual behaviour
The compiler rejects the program with
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 8: [Static type checking] - Incompatible generic argument types. Cannot assign Foo<java.lang.Object> to: T @ line 8, column 5. y ^ 1 error
Expected behaviour
Compile successfully
*NOTE:* This bug occurs only when `test` and `Foo` have type parameters with different names.
Tested against master (commit: 5c468cd352f37fb5c599a3f51534ffcc55b339ed).
Attachments
Issue Links
- is related to
-
GROOVY-10363 STC produces compile-time error on encoutering bounded type parameter with conditional
- Closed