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 2022/05/25 19:08:00 UTC

[jira] [Resolved] (GROOVY-6022) Static type checker should not register errors for ellipsis closure parameter annotated with @DelegatesTo

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

Eric Milles resolved GROOVY-6022.
---------------------------------
    Fix Version/s: 5.0.0-alpha-1
       Resolution: Fixed

https://github.com/apache/groovy/commit/496748a118a51b2dad33f9fd03a8039a1cf0127d

> Static type checker should not register errors for ellipsis closure parameter annotated with @DelegatesTo
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6022
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6022
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static Type Checker
>    Affects Versions: 2.1.1
>            Reporter: Maxim Medvedev
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1
>
>
> {code}
> def with(@DelegatesTo.Target Object target, @DelegatesTo(strategy = Closure.DELEGATE_FIRST) Closure... arg) {
>     for (Closure a : arg) {
>         a.delegate = target
>         a.resolveStrategy = Closure.DELEGATE_FIRST
>         a()
>     }
> }
> @CompileStatic
> def test() {
>     with(a:2) {
>         print(get('a')) //false positive error
>     } {
>         print(get('a')) //false positive error
>     }
> }
> test()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)