[ 
https://issues.apache.org/jira/browse/GROOVY-11090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17731276#comment-17731276
 ] 

Eric Milles commented on GROOVY-11090:
--------------------------------------

This type of thing should extend to lambda expressions under TypeCheced and 
maybe CompileStatic. It may also work when the closure/lambda target is a SAM 
type. 

> STC: closure param type inference for tuple
> -------------------------------------------
>
>                 Key: GROOVY-11090
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11090
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 5.0.0-alpha-1
>
>
> 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)

Reply via email to