Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following Groovy program.
@groovy.transform.CompileStatic public class Test { public static void main(String[] args) { final A<B> x = (true ? new A<>(new B()): new A<>(new C())) bar(x) // compiles bar((true ? new A<>(new B()): new A<>(new C()))) // does not compile } public static void bar(A<B> x) {} } class A<T> { T f; public A(T f) { this.f = f; } } class B {} class C extends B{}
Actual Behavior
The program does not compile, and I get the following error.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Test.groovy: 6: [Static type checking] - Cannot call Test#bar(A <B>) with arguments [A <? extends B>] @ line 6, column 7. bar((true ? new A<>(new B()): new A<>(new C()))) ^ 1 error
Expected Behavior
Compile successfully.
Comment
This should be a regression bug because it compiles with the 4.0.0-alpha-2 compiler.
Affected Version
This programs fails when compiled with the compiler from the master (commit: f0eea862549529ef4e93fafe337f86dd4ac98751).