Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following Groovy program.
@groovy.transform.CompileStatic public class Main { public static void main(String[] args) { Foo foo = new Bar() def x = new A<>(foo) bar(x) } public static void bar(A<Foo> f) {} } class A<T> { T f; public A(T f) { this.f = f; } } class Foo {} class Bar extends Foo {}
Actual Behavior
The program does not compile, and I get the following error.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.groovy: 6: [Static type checking] - Cannot call Main#bar(A <Foo>) with arguments [A <Bar>] @ line 6, column 5. bar(x) ^ 1 error
Expected Behavior
Compile successfully.
Affected Version
This should be a regression. The program compiles with 3.0.7 and 4.0.0-alpha-2, but fails with the compiler from Master (commit: e69c874e1a6a3cdeb236bad6a6faa061a30c88ca).