Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
None
-
None
-
None
Description
I have the following program
import java.util.function.Supplier; class B { Supplier<Integer> m2() { final def x = 1 { -> x + 1 } } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 5: [Static type checking] - Cannot find matching method int#call(groovy.lang.Closure). Please check if the declared type is correct and if the method exists. @ line 5, column 19. final def x = 1 ^test.groovy: 6: [Static type checking] - The variable [x] is undeclared. @ line 6, column 10. { -> x + 1 } ^test.groovy: 5: [Static type checking] - Cannot return value of type java.lang.Object on method returning type java.util.function.Supplier<java.lang.Integer> @ line 5, column 5. final def x = 1 ^3 errors
Expected behaviour
Compile successfully
Tested against master