mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin k2] AddReturnExpressionFix: do not suggest a quick fix if there is no right bracket
^KTIJ-29554 GitOrigin-RevId: aa9488718babe674febfeb7cff83ddefc9a60442
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8bfc8aedb8
commit
ffda2a4aae
+1
@@ -10,6 +10,7 @@ internal object AddReturnExpressionFixFactory {
|
||||
|
||||
val addReturnExpressionFixFactory = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.NoReturnInFunctionWithBlockBody ->
|
||||
val function = (diagnostic.psi as? KtNamedFunction) ?: return@ModCommandBased emptyList()
|
||||
if (function.bodyBlockExpression?.rBrace == null) return@ModCommandBased emptyList()
|
||||
|
||||
listOf(
|
||||
AddReturnExpressionFix(function)
|
||||
|
||||
+5
@@ -5257,6 +5257,11 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
|
||||
runTest("../../../idea/tests/testData/quickfix/addReturnExpression/emptyBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noRightBrace.kt")
|
||||
public void testNoRightBrace() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/addReturnExpression/noRightBrace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/addReturnExpression/simple.kt");
|
||||
|
||||
+5
@@ -1599,6 +1599,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
|
||||
runTest("testData/quickfix/addReturnExpression/emptyBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noRightBrace.kt")
|
||||
public void testNoRightBrace() throws Exception {
|
||||
runTest("testData/quickfix/addReturnExpression/noRightBrace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("testData/quickfix/addReturnExpression/simple.kt");
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Add 'return' expression" "false"
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
fun test(): Boolean {<caret>
|
||||
val x = 42
|
||||
Reference in New Issue
Block a user