Konstantin Nisht created GROOVY-9516:
----------------------------------------

             Summary: Static compiler infers wrong type for implicitly shared 
variables
                 Key: GROOVY-9516
                 URL: https://issues.apache.org/jira/browse/GROOVY-9516
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 2.5.11, 3.0.0
            Reporter: Konstantin Nisht


Consider the following code
{code:groovy}
class A {}
class B extends A{ def b() {}}
class C extends A{}

@CompileStatic
static foo() {
  def x = new B()
  ({ x = new C() })()
  def z = x
  z.b()
}
{code}
Here type of {{z}} in the last line of the method is deduced to be {{B}}. 
Attempt to execute {{z.b()}} leads to cast exception, which is unexpected under 
static compilation.



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

Reply via email to