You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/23 13:34:00 UTC

[jira] [Resolved] (GROOVY-10500) NamedVariant: non-trivial default value of NamedDelegate property

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

Paul King resolved GROOVY-10500.
--------------------------------
    Fix Version/s: 4.0.1
       Resolution: Fixed

Proposed PR merged.

> NamedVariant: non-trivial default value of NamedDelegate property
> -----------------------------------------------------------------
>
>                 Key: GROOVY-10500
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10500
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>              Labels: named-parameters
>             Fix For: 4.0.1
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> import groovy.transform.*
> @ToString
> class Pogo {
>     private static V = 42
>     Number n = V
> }
> @NamedVariant(autoDelegate=true)
> void test(Pogo p) {
>     print p
> }
> test([:]) // MissingPropertyException: No such property: V for class: script
> {code}
> Variable expression "V" is transferred from scope of {{Pogo}} to generated method {{test(Map)}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)