Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This code compiles normal:
@CompileStatic class B { public <T> T bar(Closure<Collection<Integer>> a) { return null } def use() { bar { [1] } } }
Switching return type cause error in code:
import groovy.transform.CompileStatic @CompileStatic class B { public def bar(Closure<Collection<Integer>> a) { return null } def use() { bar { // Error:(21, 9) Groovyc: [Static type checking] - Cannot find matching method pack.B#bar(groovy.lang.Closure <java.util.List>). [1] } } }
I believe first example should have error too. But probably after fixing in that way following code will be broken:
def foo() { def nums = [1] def res = nums.collectMany { [it] } }
Attachments
Issue Links
- links to