Do not suggest assignment as a subject in postfix templates

#KT-14077 Fixed
This commit is contained in:
Denis Zharkov
2016-09-28 20:35:56 +03:00
parent 18146fafdf
commit 54d9b4bee6
4 changed files with 17 additions and 1 deletions
@@ -140,7 +140,7 @@ private class KtExpressionPostfixTemplateSelector(
it !is KtBlockExpression &&
it !is KtDeclarationWithBody &&
!it.isEffectivelyDeclaration()
}.filter { !it.isSelector && it.parent !is KtUserType && !it.isOperationReference }
}.filter { !it.isSelector && it.parent !is KtUserType && !it.isOperationReference && !KtPsiUtil.isAssignment(it) }
.toList()
}
+5
View File
@@ -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)
}
@@ -113,6 +113,12 @@ public class PostfixTemplateProviderTestGenerated extends AbstractPostfixTemplat
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")
public void testReturn() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/return.kt");