Eric Milles created GROOVY-10981:
------------------------------------

             Summary: STC: type inference of variable expression with 
superclass field and access method
                 Key: GROOVY-10981
                 URL: https://issues.apache.org/jira/browse/GROOVY-10981
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
abstract class A {
  protected Object thing = 'field'
  String getThing() { 'property' }
}
@groovy.transform.CompileStatic
class C extends A {
  void test() {
    print thing.toUpperCase()
  }
}
new C().test()
{code}

If ".toUpperCase()" is removed, the script prints "property".  However the STC 
type recorded comes from the field.



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

Reply via email to