diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index fb4397df2d0..2c3e80fb93d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -80,6 +80,7 @@ public interface Errors { DiagnosticFactory1 UNSUPPORTED_INHERITANCE_FROM_JAVA_MEMBER_REFERENCING_KOTLIN_FUNCTION = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 UNSUPPORTED_SEALED_WHEN = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 UNSUPPORTED_SEALED_FUN_INTERFACE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 UNSUPPORTED_SUSPEND_TEST = DiagnosticFactory0.create(ERROR); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index ef085e873fc..6368a713dca 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -828,6 +828,7 @@ public class DefaultErrorMessages { MAP.put(UNSUPPORTED_INHERITANCE_FROM_JAVA_MEMBER_REFERENCING_KOTLIN_FUNCTION, "Inheritance of a Java member referencing 'kotlin.jvm.functions.FunctionN': {0} is unsupported", STRING); MAP.put(UNSUPPORTED_SEALED_WHEN, "'sealed' in front of 'when' is reserved"); MAP.put(UNSUPPORTED_SEALED_FUN_INTERFACE, "'sealed fun interface' is unsupported"); + MAP.put(UNSUPPORTED_SUSPEND_TEST, "'suspend' functions annotated with @kotlin.test.Test are unsupported"); MAP.put(EXCEPTION_FROM_ANALYZER, "Internal Error occurred while analyzing this expression:\n{0}", THROWABLE); MAP.put(MISSING_STDLIB, "{0}. Ensure you have the standard Kotlin library in dependencies", STRING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SuspendLimitationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SuspendLimitationsChecker.kt index 0e39ac2fc0d..2da810298e3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SuspendLimitationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/SuspendLimitationsChecker.kt @@ -46,7 +46,7 @@ object SuspendLimitationsChecker : DeclarationChecker { if (descriptor.annotations.any(AnnotationDescriptor::isKotlinTestAnnotation)) { declaration.modifierList?.getModifier(KtTokens.SUSPEND_KEYWORD)?.let { - context.trace.report(Errors.UNSUPPORTED.on(it, "suspend test functions")) + context.trace.report(Errors.UNSUPPORTED_SUSPEND_TEST.on(it)) } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendTest.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendTest.kt index 878d7307ca7..6d87662cbda 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendTest.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendTest.kt @@ -14,8 +14,8 @@ import kotlin.test.Test class A { @Test - suspend fun test() {} + suspend fun test() {} } @Test -suspend fun test() {} +suspend fun test() {}