Eric Milles created GROOVY-11092:
------------------------------------
Summary: STC: support coerced closure argument destructuring (for
list and tuple)
Key: GROOVY-11092
URL: https://issues.apache.org/jira/browse/GROOVY-11092
Project: Groovy
Issue Type: Improvement
Components: Static Type Checker
Reporter: Eric Milles
Consider the following:
{code:groovy}
import java.util.function.Consumer
import static groovy.lang.Tuple.tuple
@groovy.transform.TypeChecked test() {
Consumer<Tuple3<String,Number,?>> c = (x, y, z) -> { print y }
c.accept(tuple("",(Number)42,null))
}
test()
{code}
STC error: "Wrong number of parameters for method target
accept(groovy.lang.Tuple3<java.lang.String, java.lang.Number, ?>)"
This kind of list/tuple destructuring is supported by the dynamic runtime (see
{{ClosureMetaClass}}).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)