Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eric-milles opened this issue Jun 9, 2024 · 4 comments
Assignees
Labels
Milestone

Comments

@eric-milles
Copy link
Member

eric-milles commented Jun 9, 2024

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

@eric-milles eric-milles added the bug label Jun 9, 2024
@eric-milles eric-milles added this to the v5.4.0 milestone Jun 9, 2024
@eric-milles eric-milles self-assigned this Jun 9, 2024
@eric-milles
Copy link
Member Author

Additionally, the field checks added for #1468 are not restricted to static fields, which the classgen checking is limited to. But they are restricted to implicit-this (aka variable expressions) which the classgen checking is not limited to.

image

@eric-milles
Copy link
Member Author

image

image

image

@eric-milles
Copy link
Member Author

eric-milles commented Jun 10, 2024

One additional edge case:

image

@eric-milles
Copy link
Member Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant