[groovy] resolve: check property result validity (IDEA-187712)

This commit is contained in:
Daniil Ovchinnikov
2018-03-05 21:15:37 +03:00
parent ea3e2f5374
commit 643ad5571c
2 changed files with 12 additions and 1 deletions
@@ -280,7 +280,7 @@ public abstract class GroovyResolverProcessor implements PsiScopeProcessor, Elem
if (kind == GroovyResolveKind.PROPERTY) {
myAccessorProcessors.forEach(
it -> it.getResults().stream().filter(
result -> applicable == result.isApplicable()
result -> applicable == result.isValidResult()
).forEach(results::add)
);
}
@@ -1505,4 +1505,15 @@ class Foo {
disableTransformations testRootDisposable
resolveByText 'def abc = 42; [:].with { <caret>abc }', GrVariable
}
void 'test Class property vs instance property'() {
def property = resolveByText '''\
class A {
int getName() { 42 }
}
println A.<caret>name
''', PsiMethod
assert property.containingClass.qualifiedName == 'java.lang.Class'
}
}