Do not suggest assignment as a subject in postfix templates
#KT-14077 Fixed
This commit is contained in:
@@ -140,7 +140,7 @@ private class KtExpressionPostfixTemplateSelector(
|
|||||||
it !is KtBlockExpression &&
|
it !is KtBlockExpression &&
|
||||||
it !is KtDeclarationWithBody &&
|
it !is KtDeclarationWithBody &&
|
||||||
!it.isEffectivelyDeclaration()
|
!it.isEffectivelyDeclaration()
|
||||||
}.filter { !it.isSelector && it.parent !is KtUserType && !it.isOperationReference }
|
}.filter { !it.isSelector && it.parent !is KtUserType && !it.isOperationReference && !KtPsiUtil.isAssignment(it) }
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun foo(x: Any) {
|
||||||
|
var y: Any
|
||||||
|
// Only 'x' expression is suggested, not 'y = x'
|
||||||
|
y = x.par<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun foo(x: Any) {
|
||||||
|
var y: Any
|
||||||
|
// Only 'x' expression is suggested, not 'y = x'
|
||||||
|
y = (x)
|
||||||
|
}
|
||||||
+6
@@ -113,6 +113,12 @@ public class PostfixTemplateProviderTestGenerated extends AbstractPostfixTemplat
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("parAssignment.kt")
|
||||||
|
public void testParAssignment() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/parAssignment.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("return.kt")
|
@TestMetadata("return.kt")
|
||||||
public void testReturn() throws Exception {
|
public void testReturn() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/return.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/return.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user