diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.java b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.java index 01924dde85e..532af04576d 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.java +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,6 +70,15 @@ public abstract class CommonCompilerArguments { @Argument(value = "Xno-check-impl", description = "Do not check presence of 'impl' modifier in multi-platform projects") public boolean noCheckImpl; + @Argument(value = "Xcoroutines=warn") + public boolean coroutinesWarn; + + @Argument(value = "Xcoroutines=error") + public boolean coroutinesError; + + @Argument(value = "Xcoroutines=enable") + public boolean coroutinesEnable; + @Argument(value = "P", description = "Pass an option to a plugin") @ValueDescription(PLUGIN_OPTION_FORMAT) public String[] pluginOptions; diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java index 56ead052b66..2f14a9c9717 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java @@ -285,12 +285,41 @@ public abstract class CLICompiler { extraLanguageFeatures.add(LanguageFeature.MultiPlatformDoNotCheckImpl); } + LanguageFeature coroutinesApplicabilityLevel = chooseCoroutinesApplicabilityLevel(configuration, arguments); + if (coroutinesApplicabilityLevel != null) { + extraLanguageFeatures.add(coroutinesApplicabilityLevel); + } + configuration.put( CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS, new LanguageVersionSettingsImpl(languageVersion, ApiVersion.createByLanguageVersion(apiVersion), extraLanguageFeatures) ); } + @Nullable + private static LanguageFeature chooseCoroutinesApplicabilityLevel( + @NotNull CompilerConfiguration configuration, @NotNull CommonCompilerArguments arguments) { + if (!arguments.coroutinesEnable && !arguments.coroutinesError && !arguments.coroutinesWarn) { + return LanguageFeature.WarnOnCoroutines; + } + else if (arguments.coroutinesError && !arguments.coroutinesWarn && !arguments.coroutinesEnable) { + return LanguageFeature.ErrorOnCoroutines; + } + else if (arguments.coroutinesWarn && !arguments.coroutinesError && !arguments.coroutinesEnable) { + return LanguageFeature.WarnOnCoroutines; + } + else if (arguments.coroutinesEnable && !arguments.coroutinesWarn && !arguments.coroutinesError) { + return null; + } else { + String message = "The -Xcoroutines can only have one value"; + configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report( + CompilerMessageSeverity.ERROR, message, CompilerMessageLocation.NO_LOCATION + ); + + return null; + } + } + @Nullable private static LanguageVersion parseVersion( @NotNull CompilerConfiguration configuration, @Nullable String value, @NotNull String versionOf diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java index 0f5f31593a0..56270f5d876 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,22 @@ class Usage { // The magic number 29 corresponds to the similar padding width in javac and scalac command line compilers private static final int OPTION_NAME_PADDING_WIDTH = 29; + private static final String coroutinesKeyDescription = "Enable coroutines or report warnings or report errors on declarations and use sites of suspend modifier"; + public static void print(@NotNull PrintStream target, @NotNull CommonCompilerArguments arguments, boolean extraHelp) { target.println("Usage: " + arguments.executableScriptFileName() + " "); target.println("where " + (extraHelp ? "advanced" : "possible") + " options include:"); + boolean coroutinesUsagePrinted = false; for (Class clazz = arguments.getClass(); clazz != null; clazz = clazz.getSuperclass()) { for (Field field : clazz.getDeclaredFields()) { String usage = fieldUsage(field, extraHelp); if (usage != null) { + boolean coroutinesUsage = usage.contains("Xcoroutines"); + if (coroutinesUsage && coroutinesUsagePrinted) { + continue; + } else if (coroutinesUsage) { + coroutinesUsagePrinted = true; + } target.println(usage); } } @@ -51,9 +60,13 @@ class Usage { private static String fieldUsage(@NotNull Field field, boolean extraHelp) { Argument argument = field.getAnnotation(Argument.class); if (argument == null) return null; + ValueDescription description = field.getAnnotation(ValueDescription.class); - String value = argument.value(); + String argumentValue = argument.value(); + // TODO: this is a dirty hack, provide better mechanism for keys that can have several values + boolean isXCoroutinesKey = argumentValue.contains("Xcoroutines"); + String value = isXCoroutinesKey ? "Xcoroutines={enable|warn|error}" : argument.value(); boolean extraOption = value.startsWith("X") && value.length() > 1; if (extraHelp != extraOption) return null; @@ -73,6 +86,11 @@ class Usage { sb.append(description.value()); } + if (isXCoroutinesKey) { + sb.append(" "); + sb.append(coroutinesKeyDescription); + } + int width = OPTION_NAME_PADDING_WIDTH - 1; if (sb.length() >= width + 5) { // Break the line if it's too long sb.append("\n"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 5dbb470f082..7a41752b644 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -66,6 +66,9 @@ public interface Errors { DiagnosticFactory1 UNSUPPORTED_FEATURE = DiagnosticFactory1.create(ERROR); DiagnosticFactory1 EXCEPTION_FROM_ANALYZER = DiagnosticFactory1.create(ERROR); + DiagnosticFactory1 EXPERIMENTAL_FEATURE_WARNING = DiagnosticFactory1.create(WARNING); + DiagnosticFactory1 EXPERIMENTAL_FEATURE_ERROR = DiagnosticFactory1.create(ERROR); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Generic errors/warnings: applicable in many contexts 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 91c5e7129fa..f45ec55f137 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -589,6 +589,20 @@ public class DefaultErrorMessages { : "experimental and should be turned on explicitly via a command line option or in IDE settings: " + feature.getPresentableText(); } }); + MAP.put(EXPERIMENTAL_FEATURE_WARNING, "The feature is experimental: {0}", new DiagnosticParameterRenderer() { + @NotNull + @Override + public String render(LanguageFeature feature, @NotNull RenderingContext renderingContext) { + return feature.getPresentableText(); + } + }); + MAP.put(EXPERIMENTAL_FEATURE_ERROR, "The experimental feature is disabled: {0}", new DiagnosticParameterRenderer() { + @NotNull + @Override + public String render(LanguageFeature feature, @NotNull RenderingContext renderingContext) { + return feature.getPresentableText(); + } + }); MAP.put(EXCEPTION_FROM_ANALYZER, "Internal Error occurred while analyzing this expression:\n{0}", THROWABLE); MAP.put(UNNECESSARY_SAFE_CALL, "Unnecessary safe call on a non-null receiver of type {0}", RENDER_TYPE); MAP.put(UNEXPECTED_SAFE_CALL, "Safe-call is not allowed here"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index d7350258628..541aca2adbd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,6 +100,14 @@ object ModifierCheckerCore { IMPL_KEYWORD to LanguageFeature.MultiPlatformProjects ) + val errorOnFeature = mapOf( + LanguageFeature.Coroutines to LanguageFeature.ErrorOnCoroutines + ) + + val warningOnFeature = mapOf( + LanguageFeature.Coroutines to LanguageFeature.WarnOnCoroutines + ) + val featureDependenciesTargets = mapOf( LanguageFeature.InlineProperties to setOf(PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER) ) @@ -266,15 +274,29 @@ object ModifierCheckerCore { val dependency = featureDependencies[modifier] ?: return true - if (!languageVersionSettings.supportsFeature(dependency)) { + val errorOnDependencyFeature = errorOnFeature[dependency]?.let { languageVersionSettings.supportsFeature(it) } ?: false + val supportsFeature = languageVersionSettings.supportsFeature(dependency) + + if (!supportsFeature || errorOnDependencyFeature) { val restrictedTargets = featureDependenciesTargets[dependency] if (restrictedTargets != null && actualTargets.intersect(restrictedTargets).isEmpty()) { return true } - trace.report(Errors.UNSUPPORTED_FEATURE.on(node.psi, dependency)) + + if (!supportsFeature) { + trace.report(Errors.UNSUPPORTED_FEATURE.on(node.psi, dependency)) + } + else if (errorOnDependencyFeature) { + trace.report(Errors.EXPERIMENTAL_FEATURE_ERROR.on(node.psi, dependency)) + } return false } + val pairedWarningFeature = warningOnFeature[dependency] + if (pairedWarningFeature != null && languageVersionSettings.supportsFeature(pairedWarningFeature)) { + trace.report(Errors.EXPERIMENTAL_FEATURE_WARNING.on(node.psi, dependency)) + } + return true } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OperatorModifierChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OperatorModifierChecker.kt index f7b3c9bd797..69cb03406cb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OperatorModifierChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OperatorModifierChecker.kt @@ -69,4 +69,4 @@ object OperatorModifierChecker { diagnosticHolder.report(Errors.UNSUPPORTED_FEATURE.on(modifier, feature)) } } -} +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/coroutineCallChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/coroutineCallChecker.kt index 623e88c6249..24710b10569 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/coroutineCallChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/coroutineCallChecker.kt @@ -18,11 +18,13 @@ package org.jetbrains.kotlin.resolve.calls.checkers import com.intellij.psi.PsiElement import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.coroutines.hasSuspendFunctionType import org.jetbrains.kotlin.coroutines.isSuspendLambda import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor +import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.resolve.BindingContext @@ -80,9 +82,20 @@ object CoroutineSuspendCallChecker : CallChecker { object BuilderFunctionsCallChecker : CallChecker { override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { val descriptor = resolvedCall.candidateDescriptor as? FunctionDescriptor ?: return - if (descriptor.valueParameters.any { it.hasSuspendFunctionType } && - !context.languageVersionSettings.supportsFeature(LanguageFeature.Coroutines)) { - context.trace.report(Errors.UNSUPPORTED_FEATURE.on(reportOn, LanguageFeature.Coroutines)) + if (descriptor.valueParameters.any { it.hasSuspendFunctionType }) { + checkCoroutinesFeature(context.languageVersionSettings, context.trace, reportOn) } } } + +private fun checkCoroutinesFeature(languageVersionSettings: LanguageVersionSettings, diagnosticHolder: DiagnosticSink, reportOn: PsiElement) { + if (!languageVersionSettings.supportsFeature(LanguageFeature.Coroutines)) { + diagnosticHolder.report(Errors.UNSUPPORTED_FEATURE.on(reportOn, LanguageFeature.Coroutines)) + } + else if (languageVersionSettings.supportsFeature(LanguageFeature.ErrorOnCoroutines)) { + diagnosticHolder.report(Errors.EXPERIMENTAL_FEATURE_ERROR.on(reportOn, LanguageFeature.Coroutines)) + } + else if (languageVersionSettings.supportsFeature(LanguageFeature.WarnOnCoroutines)) { + diagnosticHolder.report(Errors.EXPERIMENTAL_FEATURE_WARNING.on(reportOn, LanguageFeature.Coroutines)) + } +} \ No newline at end of file diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index a7f20016bf5..fdba306a972 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -5,6 +5,8 @@ where advanced options include: -Xplugin Load plugins from the given classpath -Xmulti-platform Enable experimental language support for multi-platform projects -Xno-check-impl Do not check presence of 'impl' modifier in multi-platform projects + -Xcoroutines={enable|warn|error} Enable coroutines or report warnings or report errors on declarations and use sites of suspend modifier + Advanced options are non-standard and may be changed or removed without any notice. OK \ No newline at end of file diff --git a/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.args b/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.args new file mode 100644 index 00000000000..daad4373a5e --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.args @@ -0,0 +1,4 @@ +$TESTDATA_DIR$/simple.kt +-Xcoroutines=enable +-Xcoroutines=warn +-Xcoroutines=error \ No newline at end of file diff --git a/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.out b/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.out new file mode 100644 index 00000000000..b4ff1d1bb1a --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.out @@ -0,0 +1,2 @@ +error: the -Xcoroutines can only have one value +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.args b/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.args new file mode 100644 index 00000000000..a6bdf02e284 --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/simple.kt +-Xcoroutines=error +-Xcoroutines=enable \ No newline at end of file diff --git a/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.out b/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.out new file mode 100644 index 00000000000..b4ff1d1bb1a --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.out @@ -0,0 +1,2 @@ +error: the -Xcoroutines can only have one value +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.args b/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.args new file mode 100644 index 00000000000..5d63597a8d2 --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/simple.kt +-Xcoroutines=warn +-Xcoroutines=enable \ No newline at end of file diff --git a/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.out b/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.out new file mode 100644 index 00000000000..b4ff1d1bb1a --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.out @@ -0,0 +1,2 @@ +error: the -Xcoroutines can only have one value +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.args b/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.args new file mode 100644 index 00000000000..989221e562b --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/simple.kt +-Xcoroutines=warn +-Xcoroutines=error \ No newline at end of file diff --git a/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.out b/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.out new file mode 100644 index 00000000000..e949a41d8b3 --- /dev/null +++ b/compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.out @@ -0,0 +1,2 @@ +error: the -Xcoroutines can only have one value +COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 40546f5e2a8..89b611ceb36 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -18,6 +18,8 @@ where advanced options include: -Xplugin Load plugins from the given classpath -Xmulti-platform Enable experimental language support for multi-platform projects -Xno-check-impl Do not check presence of 'impl' modifier in multi-platform projects + -Xcoroutines={enable|warn|error} Enable coroutines or report warnings or report errors on declarations and use sites of suspend modifier + Advanced options are non-standard and may be changed or removed without any notice. OK \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.kt b/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.kt new file mode 100644 index 00000000000..cb8f3fa28e2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.kt @@ -0,0 +1,18 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// !LANGUAGE: +ErrorOnCoroutines + +suspend fun suspendHere(): String = "OK" + +fun builder(c: suspend () -> Unit) { + +} + +fun box(): String { + var result = "" + + builder { + suspendHere() + } + + return result +} diff --git a/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.txt b/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.txt new file mode 100644 index 00000000000..9ca783c969d --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.txt @@ -0,0 +1,5 @@ +package + +public fun box(): kotlin.String +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit +public suspend fun suspendHere(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.kt b/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.kt new file mode 100644 index 00000000000..39131dbdc09 --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.kt @@ -0,0 +1,18 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// !LANGUAGE: +WarnOnCoroutines + +suspend fun suspendHere(): String = "OK" + +fun builder(c: suspend () -> Unit) { + +} + +fun box(): String { + var result = "" + + builder { + suspendHere() + } + + return result +} diff --git a/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.txt b/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.txt new file mode 100644 index 00000000000..9ca783c969d --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.txt @@ -0,0 +1,5 @@ +package + +public fun box(): kotlin.String +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit +public suspend fun suspendHere(): kotlin.String diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 92591327aae..f659acec75f 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -4258,6 +4258,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("coroutinesDisabled.kt") + public void testCoroutinesDisabled() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/coroutines/coroutinesDisabled.kt"); + doTest(fileName); + } + + @TestMetadata("coroutinesEnabledWithWarning.kt") + public void testCoroutinesEnabledWithWarning() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/coroutines/coroutinesEnabledWithWarning.kt"); + doTest(fileName); + } + @TestMetadata("illegalSuspendCalls.kt") public void testIllegalSuspendCalls() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/coroutines/illegalSuspendCalls.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java index 081ba0e779f..ebdaefb2979 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -116,6 +116,30 @@ public class CliTestGenerated extends AbstractCliTest { doJvmTest(fileName); } + @TestMetadata("coroutinesEnableWarnAndErrorClash.args") + public void testCoroutinesEnableWarnAndErrorClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/coroutinesEnableWarnAndErrorClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("coroutinesErrorAndEnableClash.args") + public void testCoroutinesErrorAndEnableClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/coroutinesErrorAndEnableClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("coroutinesWarnAndEnableClash.args") + public void testCoroutinesWarnAndEnableClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/coroutinesWarnAndEnableClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("coroutinesWarnAndErrorClash.args") + public void testCoroutinesWarnAndErrorClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/coroutinesWarnAndErrorClash.args"); + doJvmTest(fileName); + } + @TestMetadata("diagnosticsOrder.args") public void testDiagnosticsOrder() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/diagnosticsOrder.args"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 3b584efd498..c490f145f8c 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -41,6 +41,9 @@ enum class LanguageFeature(val sinceVersion: LanguageVersion?) { // Experimental features MultiPlatformProjects(null), MultiPlatformDoNotCheckImpl(null), + + WarnOnCoroutines(null), + ErrorOnCoroutines(null) ; val presentableText: String