Skip to content

Fix type inferencing and syntax highlighting for outer class field vs. dynamic property #1584

@eric-milles

Description

@eric-milles

Prior to Groovy 5, a special case exists within classgen that selects static outer class field for unresolved this property expressions. Consider the following:

class Pogo {
  private static value = 1
  void test() {
    Map<String,Object> map = [value: 2]
    map.with {
      print      value
      print this.value
      def that = this
      print that.value
    }
  }
}

new Pogo().test()

This script prints "111" indicating that all "value" expressions come from the static field. However, the implicit-this occurrence is highlighted as a dynamic (map) property.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions