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

Eric Milles resolved GROOVY-11400.
----------------------------------
    Fix Version/s: 5.0.0-alpha-9
       Resolution: Fixed

https://github.com/apache/groovy/commit/040469089cf02de2c2e9fe124a74d5b50a396405

> STC: closure parameter metadata after re-assignment of variable
> ---------------------------------------------------------------
>
>                 Key: GROOVY-11400
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11400
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-9
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   def c = { p = 'foo' -> return p }
>   assert c('bar') == 'bar'
>   assert c() == 'foo'
>   c = { p, q = 'baz' -> '' + p + q }
>   assert c('foo', 'bar') == 'foobar'
>   assert c('foo') == 'foobaz'
>   c = { p, q = p.toString() -> '' + p + q }
>   assert c('foo', 'bar') == 'foobar'
>   assert c('foo') == 'foofoo'
> }
> test()
> {code}
> When "c" is assigned a new closure, the parameter metadata is not updated on 
> the original variable.  This results in errors for "c('foo','bar')" calls, 
> which are not compatible with the original closure signature.
> GROOVY-10072, GROOVY-11394



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

Reply via email to