Description
Consider the following:
@groovy.transform.TypeChecked void test() { def list_of_tuple2 = ['a','b'].withIndex() print list_of_tuple2.collect{ s,i -> s+i } } test()
STC rejects this script, saying "Incorrect number of parameters. Expected 1 but found 2" or if "s,i" is "String s, int i" a type error.
However it runs successfully without STC, printing "[a0, b1]"
Attachments
Issue Links
- is related to
-
GROOVY-11089 STC: closure param type inference for array and list
- Closed
- relates to
-
GROOVY-11135 Unable to compile: Expected type java.lang.Object for closure parameter
- Closed
-
GROOVY-11124 iterating Tuple2s loses type parameters
- Closed
-
GROOVY-11125 withIndex().collect loses type parameters
- Closed
-
GROOVY-11092 STC: support coerced closure argument destructuring (for list and tuple)
- Closed