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

Daniil Ovchinnikov updated GROOVY-8050:
---------------------------------------
    Description: 
{code}
@CompileStatic
class Outer {
  def foo = 1
  Inner createInner() { new Inner() }
  class Inner {}
}

@CompileStatic  // works without @CompileStatic
class Main {
  static void main(String[] args) {
    def i = new Outer().createInner()
    println i.foo // [Static type checking] - No such property: foo for class: 
Outer$Inner
  }
}
{code}

I think should work in both static and dynamic contexts or fail in both.
Please close this issue if this is by design.

  was:
{code}
@CompileStatic
class Outer {
  def foo = 1
  Inner createInner() { new Inner() }
  class Inner {}
}

@CompileStatic
class Main {
  static void main(String[] args) {
    def i = new Outer().createInner()
    println i.foo // [Static type checking] - No such property: foo for class: 
Outer$Inner
    // works without @CompileStatic
  }
}
{code}

I think should work in both static and dynamic contexts or fail in both.
Please close this issue if this is by design.


> Reference outer class property via inner class
> ----------------------------------------------
>
>                 Key: GROOVY-8050
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8050
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation, Static Type Checker
>    Affects Versions: 2.4.7
>            Reporter: Daniil Ovchinnikov
>
> {code}
> @CompileStatic
> class Outer {
>   def foo = 1
>   Inner createInner() { new Inner() }
>   class Inner {}
> }
> @CompileStatic  // works without @CompileStatic
> class Main {
>   static void main(String[] args) {
>     def i = new Outer().createInner()
>     println i.foo // [Static type checking] - No such property: foo for 
> class: Outer$Inner
>   }
> }
> {code}
> I think should work in both static and dynamic contexts or fail in both.
> Please close this issue if this is by design.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to