Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
class A<T1, T2 extends T1> { T1 f; A(T1 f) { this.f = f; } T2 foo() { return null; } } class Test { void test() { Integer x = 1; var y = new A<>(x).foo(); Integer z = y; } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 14: [Static type checking] - Cannot assign value of type java.lang.Object to variable of type java.lang.Integer @ line 14, column 17. Integer z = y; ^ 1 error
Expected behaviour
Compile successfully
Note that the program above compiles as expected in javac.
Tested against master (https://github.com/apache/groovy/commit/cee45d768bb65d1254a61a6dd4ce3c6a1f2ee3ca)