diff --git a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties
index 2e0b5d31d78..1a3bab65d9c 100644
--- a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties
+++ b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties
@@ -95,6 +95,7 @@ options.kotlin.attribute.descriptor.fun=Functions//Function declaration
options.kotlin.attribute.descriptor.fun.call=Functions//Function call
options.kotlin.attribute.descriptor.dynamic.fun.call=Functions//Dynamic function call
options.kotlin.attribute.descriptor.package.fun.call=Functions//Package-level function call
+options.kotlin.attribute.descriptor.suspend.fun.call=Functions//Suspend function call
options.kotlin.attribute.descriptor.extension.fun.call=Functions//Extension function call
options.kotlin.attribute.descriptor.constructor.call=Functions//Constructor call
options.kotlin.attribute.descriptor.variable.as.function.call=Properties and Variables//Variable as function call
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 ef168d3386f..15c6b179039 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
@@ -79,12 +79,13 @@ internal class FunctionsHighlightingVisitor(holder: AnnotationHolder, bindingCon
@Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(HighlighterExtension.EP_NAME)
-
+
val key = extensions.firstNotNullResult { extension ->
extension.highlightCall(callee, resolvedCall)
} ?: when {
calleeDescriptor.fqNameOrNull() == KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME -> KEYWORD
calleeDescriptor.isDynamic() -> DYNAMIC_FUNCTION_CALL
+ calleeDescriptor is FunctionDescriptor && calleeDescriptor.isSuspend -> SUSPEND_FUNCTION_CALL
resolvedCall is VariableAsFunctionResolvedCall -> {
val container = calleeDescriptor.containingDeclaration
val containedInFunctionClassOrSubclass = container is ClassDescriptor && container.defaultType.isFunctionTypeOrSubtype
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java
index ba9652cdd64..a17b3f7f601 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightingColors.java
@@ -86,6 +86,7 @@ public class KotlinHighlightingColors {
public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD);
public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("KOTLIN_CONSTRUCTOR", DefaultLanguageHighlighterColors.FUNCTION_CALL);
public static final TextAttributesKey DYNAMIC_FUNCTION_CALL = createTextAttributesKey("KOTLIN_DYNAMIC_FUNCTION_CALL");
+ public static final TextAttributesKey SUSPEND_FUNCTION_CALL = createTextAttributesKey("KOTLIN_SUSPEND_FUNCTION_CALL", KotlinHighlightingColors.FUNCTION_CALL);
public static final TextAttributesKey VARIABLE_AS_FUNCTION_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION");
public static final TextAttributesKey VARIABLE_AS_FUNCTION_LIKE_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION_LIKE");
diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java
index 52a497b4c44..8a13d4deaca 100644
--- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java
+++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java
@@ -113,6 +113,11 @@ public class PerformanceHighlightingTestGenerated extends AbstractPerformanceHig
runTest("idea/testData/highlighter/SmartCast.kt");
}
+ @TestMetadata("Suspend.kt")
+ public void testSuspend() throws Exception {
+ runTest("idea/testData/highlighter/Suspend.kt");
+ }
+
@TestMetadata("SyntheticExtensionProperty.kt")
public void testSyntheticExtensionProperty() throws Exception {
runTest("idea/testData/highlighter/SyntheticExtensionProperty.kt");
diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
index aad655c9183..5ea7e9b6f0f 100644
--- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinColorSettingsPage.kt
@@ -55,7 +55,7 @@ class KotlinColorSettingsPage : ColorSettingsPage, RainbowColorSettingsPage {
var ref = ints.size
ints.lastIndex + globalCounter
ints.forEach {
- if (it == null) return
+ if (it == null) return
println(it + ref)
}
dyn.dynamicCall()
@@ -70,7 +70,7 @@ class KotlinColorSettingsPage : ColorSettingsPage, RainbowColorSettingsPage {
}
fun Int?.bar() {
- if (this != null) {
+ if (this != null) {
println(message = toString())
}
else {
@@ -98,6 +98,12 @@ var globalCounte
typealias Predicate<T> = (T) -> Boolean
fun baz(p: Predicate<Int>) = p(42)
+
+suspend fun suspendCall() =
+ suspendFn()
+
+suspend fun suspendFn() {}
+
"""
}
@@ -175,6 +181,7 @@ var globalCounte
KotlinBundle.message("options.kotlin.attribute.descriptor.fun") to KotlinHighlightingColors.FUNCTION_DECLARATION,
KotlinBundle.message("options.kotlin.attribute.descriptor.fun.call") to KotlinHighlightingColors.FUNCTION_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.dynamic.fun.call") to KotlinHighlightingColors.DYNAMIC_FUNCTION_CALL,
+ KotlinBundle.message("options.kotlin.attribute.descriptor.suspend.fun.call") to KotlinHighlightingColors.SUSPEND_FUNCTION_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.package.fun.call") to KotlinHighlightingColors.PACKAGE_FUNCTION_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.extension.fun.call") to KotlinHighlightingColors.EXTENSION_FUNCTION_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.constructor.call") to KotlinHighlightingColors.CONSTRUCTOR_CALL,
diff --git a/idea/testData/highlighter/Suspend.kt b/idea/testData/highlighter/Suspend.kt
new file mode 100644
index 00000000000..617825f966c
--- /dev/null
+++ b/idea/testData/highlighter/Suspend.kt
@@ -0,0 +1,23 @@
+// EXPECTED_DUPLICATED_HIGHLIGHTING
+
+val fnType : suspend () -> Unit = {}
+
+val fnFnType: () -> suspend () -> Unit = { -> {}}
+
+suspend fun inSuspend(fn: suspend () -> Unit) {
+ val res: suspend (Int) -> Int = { it + 1 };
+ T2().nonSuspend()
+ .suspend1(fn)
+ .suspend1 { }
+ .suspend1 { res(5) }
+ res(5)
+ fnType()
+ fnFnType().invoke()
+}
+class T2 {
+ suspend inline fun suspend1(block: suspend () -> Unit): T2 {
+ block()
+ return this
+ }
+ fun nonSuspend() = this
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
index 13fda2a8c79..f43623bed56 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java
@@ -113,6 +113,11 @@ public class HighlightingTestGenerated extends AbstractHighlightingTest {
runTest("idea/testData/highlighter/SmartCast.kt");
}
+ @TestMetadata("Suspend.kt")
+ public void testSuspend() throws Exception {
+ runTest("idea/testData/highlighter/Suspend.kt");
+ }
+
@TestMetadata("SyntheticExtensionProperty.kt")
public void testSyntheticExtensionProperty() throws Exception {
runTest("idea/testData/highlighter/SyntheticExtensionProperty.kt");