From e3a69d118f4b7301b38365967ba606ba30992df7 Mon Sep 17 00:00:00 2001 From: Toshiaki Kameyama Date: Tue, 6 Mar 2018 05:18:25 +0300 Subject: [PATCH] Disable "Add labeled return" for `suspend` lambdas #KT-23126 Fixed --- .../idea/intentions/AddLabeledReturnInLambdaIntention.kt | 2 ++ .../intentions/addLabeledReturnInLambda/suspend.kt | 8 ++++++++ .../kotlin/idea/intentions/IntentionTestGenerated.java | 6 ++++++ 3 files changed, 16 insertions(+) create mode 100644 idea/testData/intentions/addLabeledReturnInLambda/suspend.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/AddLabeledReturnInLambdaIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/AddLabeledReturnInLambdaIntention.kt index 947be6636f9..8d3e1710916 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/AddLabeledReturnInLambdaIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/AddLabeledReturnInLambdaIntention.kt @@ -9,6 +9,7 @@ import com.intellij.codeInsight.intention.LowPriorityAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression @@ -19,6 +20,7 @@ class AddLabeledReturnInLambdaIntention : SelfTargetingRangeIntentiontrue + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index e405d8c704e..5b4d466af16 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -468,6 +468,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("suspend.kt") + public void testSuspend() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addLabeledReturnInLambda/suspend.kt"); + doTest(fileName); + } + @TestMetadata("unit.kt") public void testUnit() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addLabeledReturnInLambda/unit.kt");