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:09:00 UTC

[jira] [Updated] (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 updated GROOVY-6022:
--------------------------------
    Labels: varargs  (was: )

> 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
>              Labels: varargs
>             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)