You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2023/08/23 09:12:00 UTC

[jira] [Closed] (GROOVY-11092) STC: support coerced closure argument destructuring (for list and tuple)

     [ https://issues.apache.org/jira/browse/GROOVY-11092?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-11092.
------------------------------

> 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
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1
>
>
> 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)