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

Eric Milles updated GROOVY-11384:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
void test(Map map) {
  println map.empty
  println map.with{ empty }
  println map.with{ delegate.empty }
  println map.with{ {->owner.empty}() }
}

test( [:].withDefault{ 'entry' } )
{code}

When run as-is, the script prints "entry entry entry entry".  With STC or SC 
enabled, Groovy 3 or 4 prints "entry true true true".

  was:
Consider the following:
{code:groovy}
void test(Map map) {
  println map.empty
  println map.with{ empty }
  println map.with{ delegate.empty }
  println map.with{ {->owner.empty}() }
}

test( [:].withDefault{ 'entry' } )
{code}

When run as-is, prints "entry entry entry entry".  With STC or SC enabled, 
Groovy 3 or 4 prints "entry true true true".


> STC: map property access within closure
> ---------------------------------------
>
>                 Key: GROOVY-11384
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11384
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 3.0.21, 4.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.22
>
>
> Consider the following:
> {code:groovy}
> void test(Map map) {
>   println map.empty
>   println map.with{ empty }
>   println map.with{ delegate.empty }
>   println map.with{ {->owner.empty}() }
> }
> test( [:].withDefault{ 'entry' } )
> {code}
> When run as-is, the script prints "entry entry entry entry".  With STC or SC 
> enabled, Groovy 3 or 4 prints "entry true true true".



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

Reply via email to