Rename: Constraint search scope of parameter declared in a private member
#KT-9649 Fixed (cherry picked from commit fa144b0)
This commit is contained in:
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
@@ -84,4 +86,10 @@ public class KtFunctionLiteral extends KtFunctionNotStubbed {
|
||||
public boolean hasBody() {
|
||||
return getBodyExpression() != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SearchScope getUseScope() {
|
||||
return new LocalSearchScope(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.ItemPresentationProviders;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -177,4 +178,12 @@ public class KtParameter extends KtNamedDeclarationStub<KotlinParameterStub> imp
|
||||
if (!(parent instanceof KtParameterList)) return null;
|
||||
return ((KtParameterList) parent).getOwnerFunction();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SearchScope getUseScope() {
|
||||
KtDeclarationWithBody owner = getOwnerFunction();
|
||||
if (owner instanceof KtPrimaryConstructor && hasValOrVar()) return super.getUseScope();
|
||||
return owner != null ? owner.getUseScope() : super.getUseScope();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user