Prevent smartSelectExpression from breaking up 'this@outerClass'
The previous commit made JetThisExpression not implement JetStatementExpression. This had the side effect that smartSelectExpression over a label-qualified this expression (e.g 'this@outerClass') would now also list a plain 'this' as a potential expression. Restore the old behaviour by adding an explicit check for JetThisExpression.
This commit is contained in:
committed by
Nikolay Krasko
parent
9ce40cd17b
commit
64f67f30f0
@@ -411,7 +411,7 @@ public class JetRefactoringUtil {
|
||||
addExpression = false;
|
||||
}
|
||||
}
|
||||
else if (element.getParent() instanceof JetCallElement) {
|
||||
else if (element.getParent() instanceof JetCallElement || element.getParent() instanceof JetThisExpression) {
|
||||
addExpression = false;
|
||||
}
|
||||
else if (element.getParent() instanceof JetOperationExpression) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo() {
|
||||
val s = th<caret>is@Foo.toString()
|
||||
}
|
||||
|
||||
// 'this' should not be listed, only 'this@Foo'
|
||||
/*
|
||||
this@Foo
|
||||
this@Foo.toString()
|
||||
*/
|
||||
@@ -36,6 +36,11 @@ public class SmartSelectionTestGenerated extends AbstractSmartSelectionTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/smartSelection"), Pattern.compile("^([^\\.]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("labelledThis.kt")
|
||||
public void testLabelledThis() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/labelledThis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/simple.kt");
|
||||
|
||||
Reference in New Issue
Block a user