Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following Groovy program.
@groovy.transform.TypeChecked class Test { public void foo(Foo x) { ((true && x instanceof Bar)) ? new Bar[]{x} : null } } 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: Test.groovy: 4: [Static type checking] - Cannot convert from Foo to Bar @ line 4, column 46. instanceof Bar)) ? new Bar[]{x} : null ^ 1 error
Expected Behavior
Compile successfully.
Comment
This should be a regression bug because it works with 3.0.8 and 4.0.0-alpha-3.
Affected Version
This programs have been tested with the compiler from the master (commit: 8ea882a587ce3183c95ea1bc19dfc44367dc292e).