Eric Milles created GROOVY-11401:
------------------------------------

             Summary: STC: inferred type of name within closure (delegate 
property versus owner field)
                 Key: GROOVY-11401
                 URL: https://issues.apache.org/jira/browse/GROOVY-11401
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 4.0.21, 3.0.21
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
class C {
  private Object obj = 'field'
  @groovy.transform.TypeChecked
  void test() {
    def map = [:].withDefault{ 'entry' }
    map.with {
      def x = obj
      print x
    }
  }
}
new C().test()
{code}

This script prints "entry" but the inferred type of "x" is {{Object}} not 
{{String}}.

GROOVY-11367



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

Reply via email to