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

[jira] [Updated] (GROOVY-11090) STC: closure param type inference for tuple

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

Eric Milles updated GROOVY-11090:
---------------------------------
    Fix Version/s: 4.0.14
                       (was: 5.0.0-alpha-1)

> STC: closure param type inference for tuple
> -------------------------------------------
>
>                 Key: GROOVY-11090
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11090
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.14
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   def list_of_tuple2 = ['a','b'].withIndex()
>   print list_of_tuple2.collect{ s,i -> s+i }
> }
> test()
> {code}
> 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]"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)