Misc: Do not use empty scope for KtParameter/KtTypeParameter (possible fix for EA-1185336)

This commit is contained in:
Alexey Sedunov
2016-09-01 13:46:54 +03:00
parent 23491afde2
commit bb859ea0f6
2 changed files with 2 additions and 3 deletions
@@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders; import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.LocalSearchScope; import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope; import com.intellij.psi.search.SearchScope;
import com.intellij.psi.tree.TokenSet; import com.intellij.psi.tree.TokenSet;
@@ -192,6 +191,6 @@ public class KtParameter extends KtNamedDeclarationStub<KotlinParameterStub> imp
if (owner == null) { if (owner == null) {
owner = PsiTreeUtil.getParentOfType(this, KtExpression.class); owner = PsiTreeUtil.getParentOfType(this, KtExpression.class);
} }
return owner != null ? new LocalSearchScope(owner) : GlobalSearchScope.EMPTY_SCOPE; return new LocalSearchScope(owner != null ? owner : this);
} }
} }
@@ -91,6 +91,6 @@ public class KtTypeParameter extends KtNamedDeclarationStub<KotlinTypeParameterS
@Override @Override
public SearchScope getUseScope() { public SearchScope getUseScope() {
KtTypeParameterListOwner owner = PsiTreeUtil.getParentOfType(this, KtTypeParameterListOwner.class); KtTypeParameterListOwner owner = PsiTreeUtil.getParentOfType(this, KtTypeParameterListOwner.class);
return owner != null ? new LocalSearchScope(owner) : GlobalSearchScope.EMPTY_SCOPE; return new LocalSearchScope(owner != null ? owner : this);
} }
} }