Do not check function names in scope to suggest name for introduce variable refactoring (local values can overload function names from upper scopes).
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.TipsManager;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||
@@ -107,7 +108,7 @@ public class JetNameValidatorImpl implements JetNameValidator {
|
||||
Collection<DeclarationDescriptor> variants =
|
||||
TipsManager.getVariantsNoReceiver(expression, myBindingContext);
|
||||
for (DeclarationDescriptor variant : variants) {
|
||||
if (variant.getName().equals(name)) {
|
||||
if (variant.getName().equals(name) && variant instanceof VariableDescriptor) {
|
||||
result.set(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fun main(args : Array<String>) {
|
||||
<selection>ArrayList<Int></selection> // Select this expression and introduce a variable, you get arrayList1 proposed as a name
|
||||
}
|
||||
/*
|
||||
arrayList
|
||||
list
|
||||
*/
|
||||
+4
@@ -35,6 +35,10 @@ import java.util.Arrays;
|
||||
* Date: 07.02.12
|
||||
*/
|
||||
public class JetNameSuggesterTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testArrayList() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testGetterSure() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user