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

Eric Milles updated GROOVY-11089:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
  (new String[]{'a','b'}).with { a, b -> } // throws MissingMethodException
  ['a','b'].with { a, b -> } // param count error
}
test()
{code}

1. STC thinks it can spread array elements across closure parameters, but this 
does not work.
2. STC thinks it cannot spread list elements across closure parameters, which 
does work (if length check is lifted).

  was:
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
  (new String[]{'a','b'}).with { a, b -> } // throws MissingMethodException
  ['a','b'].with { a, b -> } // param count error
}
test()
{code}

1. STC thinks it can spread array elements across closure parameters, but this 
does not work.
2. STC thinks it cannot spread list elements acress closure parameters, which 
does work.


> STC: closure param type inference for array and list
> ----------------------------------------------------
>
>                 Key: GROOVY-11089
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11089
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.12
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   (new String[]{'a','b'}).with { a, b -> } // throws MissingMethodException
>   ['a','b'].with { a, b -> } // param count error
> }
> test()
> {code}
> 1. STC thinks it can spread array elements across closure parameters, but 
> this does not work.
> 2. STC thinks it cannot spread list elements across closure parameters, which 
> does work (if length check is lifted).



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

Reply via email to