diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LambdaWithSuspendModifierCallChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LambdaWithSuspendModifierCallChecker.kt index b4fe39cdd15..f1c7d2a4e55 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LambdaWithSuspendModifierCallChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LambdaWithSuspendModifierCallChecker.kt @@ -19,7 +19,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull import org.jetbrains.kotlin.utils.addToStdlib.safeAs object LambdaWithSuspendModifierCallChecker : CallChecker { - private val KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME = FqName("kotlin.suspend") + val KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME = FqName("kotlin.suspend") override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { val descriptor = resolvedCall.candidateDescriptor diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/FunctionsHighlightingVisitor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/FunctionsHighlightingVisitor.kt index 1c9a88cddc4..87dfe1a198b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/FunctionsHighlightingVisitor.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/FunctionsHighlightingVisitor.kt @@ -29,9 +29,11 @@ import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall +import org.jetbrains.kotlin.resolve.calls.checkers.LambdaWithSuspendModifierCallChecker import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult internal class FunctionsHighlightingVisitor(holder: AnnotationHolder, bindingContext: BindingContext) : @@ -78,6 +80,8 @@ internal class FunctionsHighlightingVisitor(holder: AnnotationHolder, bindingCon val key = Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension -> extension.highlightCall(callee, resolvedCall) } ?: when { + calleeDescriptor.fqNameOrNull() == + LambdaWithSuspendModifierCallChecker.KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME -> KEYWORD calleeDescriptor.isDynamic() -> DYNAMIC_FUNCTION_CALL resolvedCall is VariableAsFunctionResolvedCall -> { val container = calleeDescriptor.containingDeclaration diff --git a/idea/testData/highlighter/Functions.kt b/idea/testData/highlighter/Functions.kt index c42a12dc2bb..9314911b04d 100644 --- a/idea/testData/highlighter/Functions.kt +++ b/idea/testData/highlighter/Functions.kt @@ -1,3 +1,4 @@ +// WITH_RUNTIME fun global() { fun inner() { @@ -20,3 +21,9 @@ fun Int.fif 6 } } + +fun foo() { + suspend { + + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java index 210cdc093e7..b210f034b53 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java @@ -20,10 +20,7 @@ import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.testFramework.LightProjectDescriptor; -import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase; -import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor; import org.jetbrains.kotlin.test.InTextDirectivesUtils; import org.jetbrains.kotlin.test.TagsTestDataUtil; @@ -31,11 +28,6 @@ import java.io.File; import java.util.List; public abstract class AbstractHighlightingTest extends KotlinLightCodeInsightFixtureTestCase { - @NotNull - @Override - protected LightProjectDescriptor getProjectDescriptor() { - return KotlinLightProjectDescriptor.INSTANCE; - } protected void doTest(String filePath) throws Exception { String fileText = FileUtil.loadFile(new File(filePath), true); @@ -57,10 +49,4 @@ public abstract class AbstractHighlightingTest extends KotlinLightCodeInsightFix throw e; } } - - @NotNull - @Override - protected String getTestDataPath() { - return ""; - } }