Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I am not sure if this is a bug or a feature (or a general limitation of flow typing employed by Groovy).
I have the following program
class A { A foo() { def x = new A() if (false) { x = null } x } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 7: [Static type checking] - Cannot return value of type java.lang.Object on method returning type A @ line 7, column 5. x ^ 1 error
Expected behaviour
Compile successfully
Tested against master