Extraction refactorings: Do not suggest extraction of type elements
#KT-3994 Fixed
This commit is contained in:
@@ -432,6 +432,9 @@ public class JetRefactoringUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (element instanceof JetTypeElement) {
|
||||||
|
expressions.clear();
|
||||||
|
}
|
||||||
element = element.getParent();
|
element = element.getParent();
|
||||||
}
|
}
|
||||||
return expressions;
|
return expressions;
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fun foo(t: Any) {
|
||||||
|
val x = t as <caret>List<String>
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun foo(t: Any) {
|
||||||
|
val list = t as List<String>
|
||||||
|
val x = list
|
||||||
|
}
|
||||||
+6
@@ -243,6 +243,12 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest {
|
|||||||
doIntroduceVariableTest(fileName);
|
doIntroduceVariableTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TypeElement.kt")
|
||||||
|
public void testTypeElement() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceVariable/TypeElement.kt");
|
||||||
|
doIntroduceVariableTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("UnresolvedOccurrences.kt")
|
@TestMetadata("UnresolvedOccurrences.kt")
|
||||||
public void testUnresolvedOccurrences() throws Exception {
|
public void testUnresolvedOccurrences() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceVariable/UnresolvedOccurrences.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceVariable/UnresolvedOccurrences.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user