Daniil Ovchinnikov created GROOVY-9343:
------------------------------------------

             Summary: Variable type is not updated in operator assignment
                 Key: GROOVY-9343
                 URL: https://issues.apache.org/jira/browse/GROOVY-9343
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Daniil Ovchinnikov


{code}
class A { B plus(x) { new B() } }
class B { def foo() {42} }

@groovy.transform.CompileStatic
def cs() {
    def var
    var = new A()
    var = var + 1
    var.foo()
}

assert cs() == 42

@groovy.transform.CompileStatic
def cs2() {
    def var
    var = new A()
    var += 1 
    var.foo() // Cannot find matching method A#foo()
}

assert cs2() == 43
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to