Extraction refactorings: Do not suggest extraction of type elements

#KT-3994 Fixed
This commit is contained in:
Alexey Sedunov
2014-12-23 14:16:42 +03:00
parent 1e5769acfd
commit 367b99a156
4 changed files with 16 additions and 0 deletions
@@ -432,6 +432,9 @@ public class JetRefactoringUtil {
}
}
}
else if (element instanceof JetTypeElement) {
expressions.clear();
}
element = element.getParent();
}
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
}
@@ -243,6 +243,12 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest {
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")
public void testUnresolvedOccurrences() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceVariable/UnresolvedOccurrences.kt");