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

Wrong navigation for a delegate field inside a 'with' closure #363

Closed
mauromol opened this issue Nov 2, 2017 · 2 comments
Closed

Wrong navigation for a delegate field inside a 'with' closure #363

mauromol opened this issue Nov 2, 2017 · 2 comments

Comments

@mauromol
Copy link

mauromol commented Nov 2, 2017

Consider the following:

package test

class Test {
  static class Foo {
	  String someString = 'foo'
	  String other = 'other'
  }
  
  static class Bar {
	  String someString = 'bar'
	  Foo foo = new Foo()
	  
	  void doSomething() {
		  foo.with {
			  println "someString inside with closure = $someString"
			  println "other inside with closure = $other"
		  }
	  }
  }
  
  static main(args) {
	  Bar b = new Bar()
	  println "b.someString = $b.someString"
	  println "b.foo.someString = $b.foo.someString"
	  b.doSomething()
  }
}

Run the main method. You'll see that doSomething() prints foo, i.e. the someString reference within the with closure refers to Foo.someString. However, Greclipse thinks that is Bar.someString, as you can see by all of these facilities:

  • F3 over $someString
  • Ctrl+Click over $someString
  • "mark occurences" highlighting when you select $someString

Maybe it's just a problem of "precedence" between this/owner and delegate properties, because Greclipse behaves correctly with the other property (which is defined only in Foo class).

@eric-milles
Copy link
Member

ready to test

@mauromol
Copy link
Author

mauromol commented Nov 6, 2017

I tested this in 2.9.2.xx-201711060326-e46 and this use case works now, thank you! 👍

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

No branches or pull requests

2 participants