Suggest assert/return postfix templates only for statements
#KT-14079 Fixed #KT-14090 Fixed
This commit is contained in:
+2
-2
@@ -63,7 +63,7 @@ internal object KtAssertPostfixTemplate : ConstantStringBasedPostfixTemplate(
|
||||
"assert",
|
||||
"assert(expr) { \"\" }",
|
||||
"assert(\$expr$) { \"\$END$\" }",
|
||||
createExpressionSelector(statementsOnly = false, predicate = KotlinType::isBoolean)
|
||||
createExpressionSelector(statementsOnly = true, predicate = KotlinType::isBoolean)
|
||||
)
|
||||
|
||||
internal object KtParenthesizedPostfixTemplate : ConstantStringBasedPostfixTemplate(
|
||||
@@ -83,7 +83,7 @@ internal object KtReturnPostfixTemplate : ConstantStringBasedPostfixTemplate(
|
||||
"return",
|
||||
"return expr",
|
||||
"return \$expr$\$END$",
|
||||
createExpressionSelector(statementsOnly = false)
|
||||
createExpressionSelector(statementsOnly = true)
|
||||
)
|
||||
|
||||
internal object KtWhilePostfixTemplate : ConstantStringBasedPostfixTemplate(
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo(x: Any): Any {
|
||||
val y = x.return<caret>
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo(x: Any): Any {
|
||||
val y = x.return <caret>
|
||||
}
|
||||
+6
@@ -71,6 +71,12 @@ public class PostfixTemplateProviderTestGenerated extends AbstractPostfixTemplat
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noReturnForNonStatement.kt")
|
||||
public void testNoReturnForNonStatement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/noReturnForNonStatement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notBoolean.kt")
|
||||
public void testNotBoolean() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/postfix/notBoolean.kt");
|
||||
|
||||
Reference in New Issue
Block a user