mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-66339 Incorrect multiple resolve from anonymous constructor argument list
This commit is contained in:
+10
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.typedef;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -132,6 +133,15 @@ public class GrAnonymousClassDefinitionImpl extends GrTypeDefinitionImpl impleme
|
||||
return getBaseClassReferenceGroovy().getReferenceNameElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (lastParent instanceof GrArgumentList) return true;
|
||||
return super.processDeclarations(processor, state, lastParent, place);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
return true;
|
||||
|
||||
+7
@@ -29,6 +29,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAc
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.GrTopStatement
|
||||
import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
import com.intellij.psi.*
|
||||
|
||||
@@ -640,4 +641,10 @@ set<caret>Foo(2)
|
||||
public void testF1property() {
|
||||
assertInstanceOf resolve("A.groovy"), GrAccessorMethod
|
||||
}
|
||||
|
||||
public void testAnonymousClassFieldAndLocalVar() {
|
||||
final PsiElement resolved = resolve("A.groovy")
|
||||
assertInstanceOf resolved, PsiVariable
|
||||
assertTrue GroovyRefactoringUtil.isLocalVariable(resolved)
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Goo {
|
||||
Goo(p) {}
|
||||
def foo = 2
|
||||
}
|
||||
|
||||
def foo = 3
|
||||
|
||||
println new Goo(f<ref>oo) {}
|
||||
Reference in New Issue
Block a user