Smart Selector: Do not suggest expressions contained in the super-expression
#KT-4824 Fixed
This commit is contained in:
@@ -31,6 +31,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -423,7 +424,9 @@ public class JetRefactoringUtil {
|
||||
addExpression = false;
|
||||
}
|
||||
}
|
||||
else if (element.getParent() instanceof JetCallElement || element.getParent() instanceof JetThisExpression) {
|
||||
else if (element.getParent() instanceof JetCallElement
|
||||
|| element.getParent() instanceof JetThisExpression
|
||||
|| PsiTreeUtil.getParentOfType(element, JetSuperExpression.class) != null) {
|
||||
addExpression = false;
|
||||
}
|
||||
else if (element.getParent() instanceof JetOperationExpression) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = <caret>super.f() - 1
|
||||
}
|
||||
/*
|
||||
super.f()
|
||||
super.f() - 1
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = <caret>super@FF.f() - 1
|
||||
}
|
||||
/*
|
||||
super@FF.f()
|
||||
super@FF.f() - 1
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = <caret>super<EE>@FF.f() - 1
|
||||
}
|
||||
/*
|
||||
super<EE>@FF.f()
|
||||
super<EE>@FF.f() - 1
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = <caret>super<EE>.f() - 1
|
||||
}
|
||||
/*
|
||||
super<EE>.f()
|
||||
super<EE>.f() - 1
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = super<<caret>EE>.f() - 1
|
||||
}
|
||||
/*
|
||||
super<EE>.f()
|
||||
super<EE>.f() - 1
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
open class EE() {
|
||||
open fun f() = 43
|
||||
}
|
||||
|
||||
class FF() : EE() {
|
||||
override fun f() = super<<caret>EE>@FF.f() - 1
|
||||
}
|
||||
/*
|
||||
super<EE>@FF.f()
|
||||
super<EE>@FF.f() - 1
|
||||
*/
|
||||
@@ -51,4 +51,34 @@ public class SmartSelectionTestGenerated extends AbstractSmartSelectionTest {
|
||||
doTestSmartSelection("idea/testData/smartSelection/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superExpression.kt")
|
||||
public void testSuperExpression() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/superExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superExpressionWithLabel.kt")
|
||||
public void testSuperExpressionWithLabel() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/superExpressionWithLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superExpressionWithLabelAndType.kt")
|
||||
public void testSuperExpressionWithLabelAndType() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/superExpressionWithLabelAndType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superExpressionWithType.kt")
|
||||
public void testSuperExpressionWithType() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/superExpressionWithType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInSuperExpression.kt")
|
||||
public void testTypeInSuperExpression() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/typeInSuperExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInSuperExpressionWithLabel.kt")
|
||||
public void testTypeInSuperExpressionWithLabel() throws Exception {
|
||||
doTestSmartSelection("idea/testData/smartSelection/typeInSuperExpressionWithLabel.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user