From 913ed71863e0752d5b1b5273d15b02d4bb7ef617 Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Mon, 27 Jan 2020 17:06:08 +0300 Subject: [PATCH] Update error about unsupported language and API versions Set first supported version to 1.3 Add property for oldest depecated language version in order to control unsupported ones Report error on attempts to manually disable language feature from unsupported versions Update test data, drop compatibility tests for features from unsupported versions KT-36146 In progress --- .../arguments/CommonCompilerArguments.kt | 103 ++++++++++++++---- compiler/testData/cli/js/languageVersion.args | 2 +- compiler/testData/cli/js/languageVersion.kt | 8 +- compiler/testData/cli/js/languageVersion.out | 6 +- .../apiAndLanguageVersionsUnsupported.args | 7 ++ .../jvm/apiAndLanguageVersionsUnsupported.kt | 1 + .../jvm/apiAndLanguageVersionsUnsupported.out | 2 + compiler/testData/cli/jvm/apiVersion.kt | 15 ++- compiler/testData/cli/jvm/apiVersion.out | 10 +- compiler/testData/cli/jvm/apiVersion1.0.args | 7 -- compiler/testData/cli/jvm/apiVersion1.0.kt | 16 --- compiler/testData/cli/jvm/apiVersion1.0.out | 14 --- .../cli/jvm/apiVersionAndSinceNewerKotlin.out | 1 + .../jvm/apiVersionGreaterThanLanguage.args | 4 +- .../cli/jvm/apiVersionGreaterThanLanguage.out | 2 +- .../cli/jvm/apiVersionLessThanLanguage.out | 10 +- ...apiVersionLessThanLanguageUsingArgfile.out | 10 +- .../cli/jvm/apiVersionUnsupported.args | 5 + .../testData/cli/jvm/apiVersionUnsupported.kt | 1 + .../cli/jvm/apiVersionUnsupported.out | 2 + .../testData/cli/jvm/argfileWithEscaping.out | 10 +- .../cli/jvm/deprecatedApiVersion.args | 2 +- .../testData/cli/jvm/deprecatedApiVersion.out | 2 +- .../jvm/deprecatedLanguageUnsupportedApi.args | 7 ++ .../jvm/deprecatedLanguageUnsupportedApi.kt | 1 + .../jvm/deprecatedLanguageUnsupportedApi.out | 2 + .../cli/jvm/deprecatedLanguageVersion.args | 2 +- .../cli/jvm/deprecatedLanguageVersion.out | 2 +- ...disabledFeatureFromUnsupportedVersion.args | 5 + .../disabledFeatureFromUnsupportedVersion.kt | 1 + .../disabledFeatureFromUnsupportedVersion.out | 13 +++ .../jvm/internalArgEnableLanguageFeature.args | 6 +- .../jvm/internalArgEnableLanguageFeature.out | 9 +- ...internalArgNoWarningForEnablingBugfix.args | 4 +- compiler/testData/cli/jvm/kt19628_12.out | 1 + .../testData/cli/jvm/languageVersion.args | 2 +- compiler/testData/cli/jvm/languageVersion.kt | 8 +- compiler/testData/cli/jvm/languageVersion.out | 6 +- .../cli/jvm/languageVersionUnsupported.args | 5 + .../cli/jvm/languageVersionUnsupported.kt | 1 + .../cli/jvm/languageVersionUnsupported.out | 2 + .../cli/jvm/mixingArgfilesAndUsualArgs.out | 10 +- .../progressive/dataClassOverridingCopy.kt | 5 - .../nonConstValueAsVarargInAnnotation.kt | 6 - .../jvm/progressive/tailrecOnVirtualMember.kt | 3 + .../typeParametersInAnonymousObjects.kt | 3 + .../valReassignmentViaBackingField.kt | 5 - .../testData/cli/jvm/progressiveModeOff.args | 2 +- .../testData/cli/jvm/progressiveModeOff.out | 19 ++-- .../testData/cli/jvm/progressiveModeOn.out | 15 +-- .../jvm/releaseCoroutinesApiVersion1.2.out | 1 + .../cli/jvm/unsupportedTypeAlias.args | 5 - .../testData/cli/jvm/unsupportedTypeAlias.kt | 3 - .../testData/cli/jvm/unsupportedTypeAlias.out | 5 - .../cli/jvm/variableInWhenSubject.args | 6 + .../testData/cli/jvm/variableInWhenSubject.kt | 5 + .../cli/jvm/variableInWhenSubject.out | 11 ++ .../obsoleteInlineSuspend/library/a.kt | 31 ------ .../obsoleteInlineSuspend/output.txt | 1 - .../obsoleteInlineSuspend/source.kt | 36 ------ .../output.txt | 1 + .../requireKotlin/output.txt | 24 ++-- .../requireKotlinInNestedClasses/output.txt | 4 +- .../output.txt | 4 +- .../output.txt | 4 +- .../requireKotlinInNestedClassesJs/output.txt | 4 +- .../library/typeAliases.kt | 11 -- .../main.kt | 8 -- .../output.txt | 17 --- .../jvm/languageVersion/build.log.expected | 6 +- .../ant/jvm/languageVersion/build.xml | 2 +- .../ant/jvm/languageVersion/main.kt | 8 +- .../kotlin/cli/CliTestGenerated.java | 40 +++++-- .../CompileKotlinAgainstCustomBinariesTest.kt | 9 -- .../kotlin/config/LanguageVersionSettings.kt | 11 +- 75 files changed, 337 insertions(+), 305 deletions(-) create mode 100644 compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.args create mode 100644 compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.kt create mode 100644 compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.out delete mode 100644 compiler/testData/cli/jvm/apiVersion1.0.args delete mode 100644 compiler/testData/cli/jvm/apiVersion1.0.kt delete mode 100644 compiler/testData/cli/jvm/apiVersion1.0.out create mode 100644 compiler/testData/cli/jvm/apiVersionUnsupported.args create mode 100644 compiler/testData/cli/jvm/apiVersionUnsupported.kt create mode 100644 compiler/testData/cli/jvm/apiVersionUnsupported.out create mode 100644 compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.args create mode 100644 compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.kt create mode 100644 compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.out create mode 100644 compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.args create mode 100644 compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.kt create mode 100644 compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.out create mode 100644 compiler/testData/cli/jvm/languageVersionUnsupported.args create mode 100644 compiler/testData/cli/jvm/languageVersionUnsupported.kt create mode 100644 compiler/testData/cli/jvm/languageVersionUnsupported.out delete mode 100644 compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt delete mode 100644 compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt create mode 100644 compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt create mode 100644 compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt delete mode 100644 compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt delete mode 100644 compiler/testData/cli/jvm/unsupportedTypeAlias.args delete mode 100644 compiler/testData/cli/jvm/unsupportedTypeAlias.kt delete mode 100644 compiler/testData/cli/jvm/unsupportedTypeAlias.out create mode 100644 compiler/testData/cli/jvm/variableInWhenSubject.args create mode 100644 compiler/testData/cli/jvm/variableInWhenSubject.kt create mode 100644 compiler/testData/cli/jvm/variableInWhenSubject.out delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/library/a.kt delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/output.txt delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/source.kt delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/library/typeAliases.kt delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt delete mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index fe2f48bbaac..48aa8441ea1 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -426,6 +426,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() { private fun HashMap.configureLanguageFeaturesFromInternalArgs(collector: MessageCollector) { val featuresThatForcePreReleaseBinaries = mutableListOf() + val disabledFeaturesFromUnsupportedVersions = mutableListOf() var standaloneSamConversionFeaturePassedExplicitly = false var functionReferenceWithDefaultValueFeaturePassedExplicitly = false @@ -435,6 +436,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() { featuresThatForcePreReleaseBinaries += feature } + if (state == LanguageFeature.State.DISABLED && feature.sinceVersion?.isUnsupported == true) { + disabledFeaturesFromUnsupportedVersions += feature + } + when (feature) { LanguageFeature.SamConversionPerArgument -> standaloneSamConversionFeaturePassedExplicitly = true @@ -460,6 +465,14 @@ abstract class CommonCompilerArguments : CommonToolArguments() { "Following manually enabled features will force generation of pre-release binaries: ${featuresThatForcePreReleaseBinaries.joinToString()}" ) } + + if (disabledFeaturesFromUnsupportedVersions.isNotEmpty()) { + collector.report( + CompilerMessageSeverity.ERROR, + "The following features cannot be disabled manually, because the version they first appeared in is no longer " + + "supported:\n${disabledFeaturesFromUnsupportedVersions.joinToString()}" + ) + } } fun toLanguageVersionSettings(collector: MessageCollector): LanguageVersionSettings { @@ -471,32 +484,77 @@ abstract class CommonCompilerArguments : CommonToolArguments() { // (API version cannot be greater than the language version) val apiVersion = parseVersion(collector, apiVersion, "API") ?: languageVersion + checkApiVersionIsNotGreaterThenLanguageVersion(languageVersion, apiVersion, collector) + checkLanguageVersionIsStable(languageVersion, collector) + checkOutdatedVersions(languageVersion, apiVersion, collector) + checkProgressiveMode(languageVersion, collector) + + val languageVersionSettings = LanguageVersionSettingsImpl( + languageVersion, + ApiVersion.createByLanguageVersion(apiVersion), + configureAnalysisFlags(collector), + configureLanguageFeatures(collector) + ) + + checkCoroutines(languageVersionSettings, collector) + + return languageVersionSettings + } + + private fun checkApiVersionIsNotGreaterThenLanguageVersion( + languageVersion: LanguageVersion, + apiVersion: LanguageVersion, + collector: MessageCollector + ) { if (apiVersion > languageVersion) { collector.report( CompilerMessageSeverity.ERROR, "-api-version (${apiVersion.versionString}) cannot be greater than -language-version (${languageVersion.versionString})" ) } + } + private fun checkLanguageVersionIsStable(languageVersion: LanguageVersion, collector: MessageCollector) { if (!languageVersion.isStable) { collector.report( CompilerMessageSeverity.STRONG_WARNING, - "Language version ${languageVersion.versionString} is experimental, there are no backwards compatibility guarantees for new language and library features" + "Language version ${languageVersion.versionString} is experimental, there are no backwards compatibility guarantees for " + + "new language and library features" ) } + } - val deprecatedVersion = when { - languageVersion < LanguageVersion.FIRST_SUPPORTED -> "Language version ${languageVersion.versionString}" - apiVersion < LanguageVersion.FIRST_SUPPORTED -> "API version ${apiVersion.versionString}" + private fun checkOutdatedVersions(language: LanguageVersion, api: LanguageVersion, collector: MessageCollector) { + val (version, versionKind) = findOutdatedVersion(language, api) ?: return + when { + version.isUnsupported -> { + collector.report( + CompilerMessageSeverity.ERROR, + "${versionKind.text} version ${version.versionString} is no longer supported; " + + "please, use version ${LanguageVersion.OLDEST_DEPRECATED.versionString} or greater." + ) + } + version.isDeprecated -> { + collector.report( + CompilerMessageSeverity.STRONG_WARNING, + "${versionKind.text} version ${version.versionString} is deprecated " + + "and its support will be removed in a future version of Kotlin" + ) + } + } + } + + private fun findOutdatedVersion(language: LanguageVersion, api: LanguageVersion): Pair? { + return when { + language.isUnsupported -> language to VersionKind.LANGUAGE + api.isUnsupported -> api to VersionKind.API + language.isDeprecated -> language to VersionKind.LANGUAGE + api.isDeprecated -> api to VersionKind.API else -> null } - if (deprecatedVersion != null) { - collector.report( - CompilerMessageSeverity.STRONG_WARNING, - "$deprecatedVersion is deprecated and its support will be removed in a future version of Kotlin" - ) - } + } + private fun checkProgressiveMode(languageVersion: LanguageVersion, collector: MessageCollector) { if (progressiveMode && languageVersion < LanguageVersion.LATEST_STABLE) { collector.report( CompilerMessageSeverity.STRONG_WARNING, @@ -506,14 +564,9 @@ abstract class CommonCompilerArguments : CommonToolArguments() { "or turning off progressive mode." ) } + } - val languageVersionSettings = LanguageVersionSettingsImpl( - languageVersion, - ApiVersion.createByLanguageVersion(apiVersion), - configureAnalysisFlags(collector), - configureLanguageFeatures(collector) - ) - + private fun checkCoroutines(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) { if (coroutinesState != DEFAULT) { collector.report( @@ -522,19 +575,21 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) } } + } - return languageVersionSettings + private enum class VersionKind(val text: String) { + LANGUAGE("Language"), API("API") } private fun parseVersion(collector: MessageCollector, value: String?, versionOf: String): LanguageVersion? = if (value == null) null else LanguageVersion.fromVersionString(value) - ?: run { - val versionStrings = LanguageVersion.values().map(LanguageVersion::description) - val message = "Unknown $versionOf version: $value\nSupported $versionOf versions: ${versionStrings.joinToString(", ")}" - collector.report(CompilerMessageSeverity.ERROR, message, null) - null - } + ?: run { + val versionStrings = LanguageVersion.values().map(LanguageVersion::description) + val message = "Unknown $versionOf version: $value\nSupported $versionOf versions: ${versionStrings.joinToString(", ")}" + collector.report(CompilerMessageSeverity.ERROR, message, null) + null + } // Used only for serialize and deserialize settings. Don't use in other places! class DummyImpl : CommonCompilerArguments() diff --git a/compiler/testData/cli/js/languageVersion.args b/compiler/testData/cli/js/languageVersion.args index a960064400e..b571ef026b5 100644 --- a/compiler/testData/cli/js/languageVersion.args +++ b/compiler/testData/cli/js/languageVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt -output $TEMP_DIR$/out.js -language-version -1.2 +1.3 diff --git a/compiler/testData/cli/js/languageVersion.kt b/compiler/testData/cli/js/languageVersion.kt index de7d853c6df..56cd89c4a35 100644 --- a/compiler/testData/cli/js/languageVersion.kt +++ b/compiler/testData/cli/js/languageVersion.kt @@ -1,5 +1,9 @@ package test -annotation class Outer { - class Nested +fun test() { + while (true) { + when { + true -> break + } + } } diff --git a/compiler/testData/cli/js/languageVersion.out b/compiler/testData/cli/js/languageVersion.out index a96063e15cb..11d240d323d 100644 --- a/compiler/testData/cli/js/languageVersion.out +++ b/compiler/testData/cli/js/languageVersion.out @@ -1,4 +1,4 @@ -compiler/testData/cli/js/languageVersion.kt:4:5: error: members are not allowed in annotation class - class Nested - ^ +compiler/testData/cli/js/languageVersion.kt:6:21: error: 'break' and 'continue' are not allowed in 'when' statements. Consider using labels to continue/break from the outer loop + true -> break + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.args b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.args new file mode 100644 index 00000000000..f87a46c64f6 --- /dev/null +++ b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.args @@ -0,0 +1,7 @@ +$TESTDATA_DIR$/apiAndLanguageVersionsUnsupported.kt +-d +$TEMP_DIR$ +-language-version +1.1 +-api-version +1.0 \ No newline at end of file diff --git a/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.kt b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.out b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.out new file mode 100644 index 00000000000..3865fd31ea8 --- /dev/null +++ b/compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.out @@ -0,0 +1,2 @@ +error: language version 1.1 is no longer supported; please, use version 1.2 or greater. +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersion.kt b/compiler/testData/cli/jvm/apiVersion.kt index bf60469fd3b..c2b3f9c5b1d 100644 --- a/compiler/testData/cli/jvm/apiVersion.kt +++ b/compiler/testData/cli/jvm/apiVersion.kt @@ -1,3 +1,14 @@ -fun test() { - ""::class.sealedSubclasses +class A + +fun foo( + p00: A, p01: A, p02: A, p03: A, p04: A, p05: A, p06: A, p07: A, p08: A, p09: A, + p10: A, p11: A, p12: A, p13: A, p14: A, p15: A, p16: A, p17: A, p18: A, p19: A, + p20: A, p21: A, p22: A, p23: A, p24: A, p25: A, p26: A, p27: A, p28: A, p29: A +) {} + +fun bar(x: Any) {} + +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + bar(::foo) + bar(x) } diff --git a/compiler/testData/cli/jvm/apiVersion.out b/compiler/testData/cli/jvm/apiVersion.out index ecb959d06b0..dfbbdc6df42 100644 --- a/compiler/testData/cli/jvm/apiVersion.out +++ b/compiler/testData/cli/jvm/apiVersion.out @@ -1,4 +1,8 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses - ""::class.sealedSubclasses - ^ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin +compiler/testData/cli/jvm/apiVersion.kt:11:20: error: the feature "function types with big arity" is only available since API version 1.3 +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + ^ +compiler/testData/cli/jvm/apiVersion.kt:12:9: error: the feature "function types with big arity" is only available since API version 1.3 + bar(::foo) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersion1.0.args b/compiler/testData/cli/jvm/apiVersion1.0.args deleted file mode 100644 index 6ef00e03add..00000000000 --- a/compiler/testData/cli/jvm/apiVersion1.0.args +++ /dev/null @@ -1,7 +0,0 @@ -$TESTDATA_DIR$/apiVersion1.0.kt --d -$TEMP_DIR$ --language-version -1.1 --api-version -1.0 diff --git a/compiler/testData/cli/jvm/apiVersion1.0.kt b/compiler/testData/cli/jvm/apiVersion1.0.kt deleted file mode 100644 index 8ff55ac16ed..00000000000 --- a/compiler/testData/cli/jvm/apiVersion1.0.kt +++ /dev/null @@ -1,16 +0,0 @@ -typealias Foo = Int - -sealed class A -data class B(val foo: Int): A() - -inline val f get() = "" - -suspend fun test() { - ""::class - ""::toString - - Foo::class - Foo::toString - - val b by lazy { "" } -} diff --git a/compiler/testData/cli/jvm/apiVersion1.0.out b/compiler/testData/cli/jvm/apiVersion1.0.out deleted file mode 100644 index be6597df353..00000000000 --- a/compiler/testData/cli/jvm/apiVersion1.0.out +++ /dev/null @@ -1,14 +0,0 @@ -warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin -compiler/testData/cli/jvm/apiVersion1.0.kt:8:1: error: the feature "coroutines" is only available since API version 1.1 (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines) -suspend fun test() { -^ -compiler/testData/cli/jvm/apiVersion1.0.kt:9:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class - ^ -compiler/testData/cli/jvm/apiVersion1.0.kt:10:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::toString - ^ -compiler/testData/cli/jvm/apiVersion1.0.kt:15:11: error: the feature "local delegated properties" is only available since API version 1.1 - val b by lazy { "" } - ^ -COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out index 1e0da98317a..03b29a8f588 100644 --- a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out +++ b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out @@ -1,3 +1,4 @@ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.2 @SinceKotlin("1.3") ^ diff --git a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args index a026e3ef354..2097bb3a0ff 100644 --- a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args +++ b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args @@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version -1.3 +1.4 -language-version -1.2 +1.3 diff --git a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out index e77af240675..a41ca754b6d 100644 --- a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out +++ b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out @@ -1,2 +1,2 @@ -error: -api-version (1.3) cannot be greater than -language-version (1.2) +error: -api-version (1.4) cannot be greater than -language-version (1.3) COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out index ecb959d06b0..dfbbdc6df42 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out @@ -1,4 +1,8 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses - ""::class.sealedSubclasses - ^ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin +compiler/testData/cli/jvm/apiVersion.kt:11:20: error: the feature "function types with big arity" is only available since API version 1.3 +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + ^ +compiler/testData/cli/jvm/apiVersion.kt:12:9: error: the feature "function types with big arity" is only available since API version 1.3 + bar(::foo) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out b/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out index ecb959d06b0..dfbbdc6df42 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out @@ -1,4 +1,8 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses - ""::class.sealedSubclasses - ^ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin +compiler/testData/cli/jvm/apiVersion.kt:11:20: error: the feature "function types with big arity" is only available since API version 1.3 +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + ^ +compiler/testData/cli/jvm/apiVersion.kt:12:9: error: the feature "function types with big arity" is only available since API version 1.3 + bar(::foo) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionUnsupported.args b/compiler/testData/cli/jvm/apiVersionUnsupported.args new file mode 100644 index 00000000000..2ce47ef933f --- /dev/null +++ b/compiler/testData/cli/jvm/apiVersionUnsupported.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/apiVersionUnsupported.kt +-d +$TEMP_DIR$ +-api-version +1.1 \ No newline at end of file diff --git a/compiler/testData/cli/jvm/apiVersionUnsupported.kt b/compiler/testData/cli/jvm/apiVersionUnsupported.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/cli/jvm/apiVersionUnsupported.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/cli/jvm/apiVersionUnsupported.out b/compiler/testData/cli/jvm/apiVersionUnsupported.out new file mode 100644 index 00000000000..3c2296a1edd --- /dev/null +++ b/compiler/testData/cli/jvm/apiVersionUnsupported.out @@ -0,0 +1,2 @@ +error: API version 1.1 is no longer supported; please, use version 1.2 or greater. +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/argfileWithEscaping.out b/compiler/testData/cli/jvm/argfileWithEscaping.out index 999484b93f9..221c87d086c 100644 --- a/compiler/testData/cli/jvm/argfileWithEscaping.out +++ b/compiler/testData/cli/jvm/argfileWithEscaping.out @@ -1,6 +1,10 @@ warning: flag is not supported by this version of the compiler: -Xdouble ' quote ' escaped " sequence / warning: flag is not supported by this version of the compiler: -Xsingle " quote " escaped ' sequence / -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses - ""::class.sealedSubclasses - ^ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin +compiler/testData/cli/jvm/apiVersion.kt:11:20: error: the feature "function types with big arity" is only available since API version 1.3 +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + ^ +compiler/testData/cli/jvm/apiVersion.kt:12:9: error: the feature "function types with big arity" is only available since API version 1.3 + bar(::foo) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/deprecatedApiVersion.args b/compiler/testData/cli/jvm/deprecatedApiVersion.args index ad63ad898b9..69558a4e07d 100644 --- a/compiler/testData/cli/jvm/deprecatedApiVersion.args +++ b/compiler/testData/cli/jvm/deprecatedApiVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt -d $TEMP_DIR$ -api-version -1.1 +1.2 diff --git a/compiler/testData/cli/jvm/deprecatedApiVersion.out b/compiler/testData/cli/jvm/deprecatedApiVersion.out index ae2cd12e9f9..99993437fbd 100644 --- a/compiler/testData/cli/jvm/deprecatedApiVersion.out +++ b/compiler/testData/cli/jvm/deprecatedApiVersion.out @@ -1,2 +1,2 @@ -warning: API version 1.1 is deprecated and its support will be removed in a future version of Kotlin +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin OK diff --git a/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.args b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.args new file mode 100644 index 00000000000..d90f64652cd --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.args @@ -0,0 +1,7 @@ +$TESTDATA_DIR$/deprecatedLanguageUnsupportedApi.kt +-d +$TEMP_DIR$ +-language-version +1.2 +-api-version +1.1 \ No newline at end of file diff --git a/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.kt b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.out b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.out new file mode 100644 index 00000000000..3c2296a1edd --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.out @@ -0,0 +1,2 @@ +error: API version 1.1 is no longer supported; please, use version 1.2 or greater. +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/deprecatedLanguageVersion.args b/compiler/testData/cli/jvm/deprecatedLanguageVersion.args index e14acd20ae9..d64e4c7b5cc 100644 --- a/compiler/testData/cli/jvm/deprecatedLanguageVersion.args +++ b/compiler/testData/cli/jvm/deprecatedLanguageVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt -d $TEMP_DIR$ -language-version -1.1 +1.2 diff --git a/compiler/testData/cli/jvm/deprecatedLanguageVersion.out b/compiler/testData/cli/jvm/deprecatedLanguageVersion.out index c0bcb9208cf..7d53695d487 100644 --- a/compiler/testData/cli/jvm/deprecatedLanguageVersion.out +++ b/compiler/testData/cli/jvm/deprecatedLanguageVersion.out @@ -1,2 +1,2 @@ -warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin +warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin OK diff --git a/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.args b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.args new file mode 100644 index 00000000000..184577f6b13 --- /dev/null +++ b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/disabledFeatureInUnsupportedVersion.kt +-XXLanguage\:-TypeAliases +-XXLanguage\:-BoundCallableReferences +-d +$TEMP_DIR$ \ No newline at end of file diff --git a/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.kt b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.out b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.out new file mode 100644 index 00000000000..df6c3767687 --- /dev/null +++ b/compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.out @@ -0,0 +1,13 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:-TypeAliases +-XXLanguage:-BoundCallableReferences + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +error: the following features cannot be disabled manually, because the version they first appeared in is no longer supported: +TypeAliases, BoundCallableReferences +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.args b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.args index bc8bfa21c6b..ca111f84f4e 100644 --- a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.args +++ b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.args @@ -1,6 +1,6 @@ -$TESTDATA_DIR$/legacySmartCastsAfterTry.kt +$TESTDATA_DIR$/variableInWhenSubject.kt -d $TEMP_DIR$ -language-version -1.1 --XXLanguage\:+SoundSmartCastsAfterTry \ No newline at end of file +1.2 +-XXLanguage\:+VariableDeclarationInWhenSubject \ No newline at end of file diff --git a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out index 8fc0b31902d..4fbe65494dc 100644 --- a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out +++ b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out @@ -1,14 +1,11 @@ warning: ATTENTION! This build uses unsafe internal compiler arguments: --XXLanguage:+SoundSmartCastsAfterTry +-XXLanguage:+VariableDeclarationInWhenSubject This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin -compiler/testData/cli/jvm/legacySmartCastsAfterTry.kt:8:9: error: only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? - some.length - ^ -COMPILATION_ERROR +warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin +OK diff --git a/compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args b/compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args index 2d8082d8e2e..7d24690f7c6 100644 --- a/compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args +++ b/compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args @@ -2,5 +2,5 @@ $TESTDATA_DIR$/simple.kt -d $TEMP_DIR$ -language-version -1.2 --XXLanguage\:+ProhibitDataClassesOverridingCopy +1.3 +-XXLanguage\:+RestrictReturnStatementTarget diff --git a/compiler/testData/cli/jvm/kt19628_12.out b/compiler/testData/cli/jvm/kt19628_12.out index d86bac9de59..7d53695d487 100644 --- a/compiler/testData/cli/jvm/kt19628_12.out +++ b/compiler/testData/cli/jvm/kt19628_12.out @@ -1 +1,2 @@ +warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin OK diff --git a/compiler/testData/cli/jvm/languageVersion.args b/compiler/testData/cli/jvm/languageVersion.args index 54699e92aca..1d9b4e2ce42 100644 --- a/compiler/testData/cli/jvm/languageVersion.args +++ b/compiler/testData/cli/jvm/languageVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt -d $TEMP_DIR$ -language-version -1.2 +1.3 diff --git a/compiler/testData/cli/jvm/languageVersion.kt b/compiler/testData/cli/jvm/languageVersion.kt index de7d853c6df..56cd89c4a35 100644 --- a/compiler/testData/cli/jvm/languageVersion.kt +++ b/compiler/testData/cli/jvm/languageVersion.kt @@ -1,5 +1,9 @@ package test -annotation class Outer { - class Nested +fun test() { + while (true) { + when { + true -> break + } + } } diff --git a/compiler/testData/cli/jvm/languageVersion.out b/compiler/testData/cli/jvm/languageVersion.out index 4cede899bca..f32b75ce232 100644 --- a/compiler/testData/cli/jvm/languageVersion.out +++ b/compiler/testData/cli/jvm/languageVersion.out @@ -1,4 +1,4 @@ -compiler/testData/cli/jvm/languageVersion.kt:4:5: error: members are not allowed in annotation class - class Nested - ^ +compiler/testData/cli/jvm/languageVersion.kt:6:21: error: 'break' and 'continue' are not allowed in 'when' statements. Consider using labels to continue/break from the outer loop + true -> break + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/languageVersionUnsupported.args b/compiler/testData/cli/jvm/languageVersionUnsupported.args new file mode 100644 index 00000000000..0d71ab4d147 --- /dev/null +++ b/compiler/testData/cli/jvm/languageVersionUnsupported.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/languageVersionUnsupported.kt +-d +$TEMP_DIR$ +-language-version +1.1 diff --git a/compiler/testData/cli/jvm/languageVersionUnsupported.kt b/compiler/testData/cli/jvm/languageVersionUnsupported.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/cli/jvm/languageVersionUnsupported.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/cli/jvm/languageVersionUnsupported.out b/compiler/testData/cli/jvm/languageVersionUnsupported.out new file mode 100644 index 00000000000..3865fd31ea8 --- /dev/null +++ b/compiler/testData/cli/jvm/languageVersionUnsupported.out @@ -0,0 +1,2 @@ +error: language version 1.1 is no longer supported; please, use version 1.2 or greater. +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out index ecb959d06b0..dfbbdc6df42 100644 --- a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out +++ b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out @@ -1,4 +1,8 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses - ""::class.sealedSubclasses - ^ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin +compiler/testData/cli/jvm/apiVersion.kt:11:20: error: the feature "function types with big arity" is only available since API version 1.3 +fun test(vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) { + ^ +compiler/testData/cli/jvm/apiVersion.kt:12:9: error: the feature "function types with big arity" is only available since API version 1.3 + bar(::foo) + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt b/compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt deleted file mode 100644 index b99b20d8c06..00000000000 --- a/compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt +++ /dev/null @@ -1,5 +0,0 @@ -interface WithCopy { - fun copy(str: T): WithCopy -} - -data class Test(val str: String): WithCopy \ No newline at end of file diff --git a/compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt b/compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt deleted file mode 100644 index e9a2e152b4b..00000000000 --- a/compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt +++ /dev/null @@ -1,6 +0,0 @@ -val nonConstArray = longArrayOf(0) - -annotation class Anno(vararg val value: Long) - -@Anno(value = nonConstArray) -fun foo1() {} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt b/compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt new file mode 100644 index 00000000000..a515aa2d979 --- /dev/null +++ b/compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt @@ -0,0 +1,3 @@ +open class A { + tailrec open fun foo(x: Int) {} +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt b/compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt new file mode 100644 index 00000000000..7fbb0ebe12b --- /dev/null +++ b/compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt @@ -0,0 +1,3 @@ +fun test() { + val x = object { } +} diff --git a/compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt b/compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt deleted file mode 100644 index 294d9f37b43..00000000000 --- a/compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt +++ /dev/null @@ -1,5 +0,0 @@ -val my: Int = 1 - get() { - field++ - return field - } diff --git a/compiler/testData/cli/jvm/progressiveModeOff.args b/compiler/testData/cli/jvm/progressiveModeOff.args index cca6bb66990..1145a2f7d56 100644 --- a/compiler/testData/cli/jvm/progressiveModeOff.args +++ b/compiler/testData/cli/jvm/progressiveModeOff.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/progressive -d $TEMP_DIR$ -language-version -1.2 +1.3 diff --git a/compiler/testData/cli/jvm/progressiveModeOff.out b/compiler/testData/cli/jvm/progressiveModeOff.out index 55607b301d8..9c4d8e5a9bf 100644 --- a/compiler/testData/cli/jvm/progressiveModeOff.out +++ b/compiler/testData/cli/jvm/progressiveModeOff.out @@ -1,10 +1,13 @@ -compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt:5:1: warning: function 'copy' generated for the data class has default values for parameters, and conflicts with member of supertype 'WithCopy' -data class Test(val str: String): WithCopy -^ -compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt:5:15: warning: an annotation argument must be a compile-time constant -@Anno(value = nonConstArray) - ^ -compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt:3:9: warning: reassignment of read-only property via backing field is deprecated - field++ +compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: warning: a function is marked as tail-recursive but no tail calls are found + tailrec open fun foo(x: Int) {} + ^ +compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: warning: tailrec on open members is deprecated + tailrec open fun foo(x: Int) {} + ^ +compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:9: warning: variable 'x' is never used + val x = object { } ^ +compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:19: warning: type parameters for anonymous objects are deprecated + val x = object { } + ^ OK diff --git a/compiler/testData/cli/jvm/progressiveModeOn.out b/compiler/testData/cli/jvm/progressiveModeOn.out index d878cf0e340..e02fa0abd5a 100644 --- a/compiler/testData/cli/jvm/progressiveModeOn.out +++ b/compiler/testData/cli/jvm/progressiveModeOn.out @@ -1,10 +1,7 @@ -compiler/testData/cli/jvm/progressive/dataClassOverridingCopy.kt:5:1: error: function 'copy' generated for the data class has default values for parameters, and conflicts with member of supertype 'WithCopy' -data class Test(val str: String): WithCopy -^ -compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt:5:15: error: an annotation argument must be a compile-time constant -@Anno(value = nonConstArray) - ^ -compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt:3:9: error: reassignment of read-only property via backing field - field++ - ^ +compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: error: tailrec is not allowed on open members + tailrec open fun foo(x: Int) {} + ^ +compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:19: error: type parameters are not allowed for objects + val x = object { } + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.out b/compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.out index e4578165e96..a11a4f5a54e 100644 --- a/compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.out +++ b/compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.out @@ -1,3 +1,4 @@ +warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:1:1: error: unsupported [cannot use release coroutines with api version less than 1.3] suspend fun dummy() {} ^ diff --git a/compiler/testData/cli/jvm/unsupportedTypeAlias.args b/compiler/testData/cli/jvm/unsupportedTypeAlias.args deleted file mode 100644 index ce89167f1ed..00000000000 --- a/compiler/testData/cli/jvm/unsupportedTypeAlias.args +++ /dev/null @@ -1,5 +0,0 @@ --language-version -1.0 -$TESTDATA_DIR$/unsupportedTypeAlias.kt --d -$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/unsupportedTypeAlias.kt b/compiler/testData/cli/jvm/unsupportedTypeAlias.kt deleted file mode 100644 index 82e694f5c03..00000000000 --- a/compiler/testData/cli/jvm/unsupportedTypeAlias.kt +++ /dev/null @@ -1,3 +0,0 @@ -package test - -typealias Unused = String \ No newline at end of file diff --git a/compiler/testData/cli/jvm/unsupportedTypeAlias.out b/compiler/testData/cli/jvm/unsupportedTypeAlias.out deleted file mode 100644 index 2dae0042104..00000000000 --- a/compiler/testData/cli/jvm/unsupportedTypeAlias.out +++ /dev/null @@ -1,5 +0,0 @@ -warning: language version 1.0 is deprecated and its support will be removed in a future version of Kotlin -compiler/testData/cli/jvm/unsupportedTypeAlias.kt:3:1: error: the feature "type aliases" is only available since language version 1.1 -typealias Unused = String -^ -COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/variableInWhenSubject.args b/compiler/testData/cli/jvm/variableInWhenSubject.args new file mode 100644 index 00000000000..ca111f84f4e --- /dev/null +++ b/compiler/testData/cli/jvm/variableInWhenSubject.args @@ -0,0 +1,6 @@ +$TESTDATA_DIR$/variableInWhenSubject.kt +-d +$TEMP_DIR$ +-language-version +1.2 +-XXLanguage\:+VariableDeclarationInWhenSubject \ No newline at end of file diff --git a/compiler/testData/cli/jvm/variableInWhenSubject.kt b/compiler/testData/cli/jvm/variableInWhenSubject.kt new file mode 100644 index 00000000000..3923c4d8d34 --- /dev/null +++ b/compiler/testData/cli/jvm/variableInWhenSubject.kt @@ -0,0 +1,5 @@ +fun test(s: String?) = + when (val v = s) { + null -> "" + else -> v + } diff --git a/compiler/testData/cli/jvm/variableInWhenSubject.out b/compiler/testData/cli/jvm/variableInWhenSubject.out new file mode 100644 index 00000000000..4fbe65494dc --- /dev/null +++ b/compiler/testData/cli/jvm/variableInWhenSubject.out @@ -0,0 +1,11 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+VariableDeclarationInWhenSubject + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin +OK diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/library/a.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/library/a.kt deleted file mode 100644 index 0c55e519627..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/library/a.kt +++ /dev/null @@ -1,31 +0,0 @@ -package library - -import kotlin.coroutines.experimental.* - -var continuation: Continuation? = null -val sb = java.lang.StringBuilder() - -fun append(s: String) { sb.append(s) } - -val libraryResult: String get() = sb.toString() - -// this is an inline tail-suspend function that should work properly despite being compiler by -// compiler before 1.1.4 version that did not include suspension marks into bytecode. -// In order to test that it works properly it shall actually suspend during its execution -inline suspend fun foo(block: () -> Unit) { - append("(foo)") - block() - return suspendCoroutine { continuation = it } -} - -suspend fun bar() { - append("(bar)") - return suspendCoroutine { continuation = it } -} - -fun resumeLibrary() { - continuation?.let { - continuation = null - it.resume(Unit) - } -} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/output.txt deleted file mode 100644 index a0aba9318ad..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/output.txt +++ /dev/null @@ -1 +0,0 @@ -OK \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/source.kt deleted file mode 100644 index 02c640eeb76..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/obsoleteInlineSuspend/source.kt +++ /dev/null @@ -1,36 +0,0 @@ -import library.* -import kotlin.coroutines.experimental.* - -suspend fun test() { - append("[foo]") - foo { // we are inlining foo here - append("(block)") - } - append("[bar]") - bar() // and invoking suspending function bar - append("[test]") -} - -fun runBlockingLibrary(block: suspend () -> Unit): String { - var done = false - block.startCoroutine(object : Continuation { - override val context: CoroutineContext = EmptyCoroutineContext - override fun resume(value: Unit) { done = true } - override fun resumeWithException(exception: Throwable) { throw exception } - }) - var resumeCounter = 0 - while (!done) { - resumeCounter++ - resumeLibrary() - } - return "$libraryResult:resumes=$resumeCounter" -} - -// Retruns array of expected and received string -fun run(): Array { - val result = runBlockingLibrary { - test() - } - return arrayOf("[foo](foo)(block)[bar](bar)[test]:resumes=2", result) -} - diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt index b3403fe1706..43a9bc231fd 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt @@ -1,3 +1,4 @@ +warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt:2:5: error: 'dummy(): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2 dummy() ^ diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/output.txt index a9689b6c565..55b446859e9 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/output.txt @@ -1,37 +1,37 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.3. This declaration is only supported since Kotlin 42.33 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.4. This declaration is only supported since Kotlin 42.33 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.4 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:13: error: 'A' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.4 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.3. This declaration is only supported since Kotlin 42.33 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.4. This declaration is only supported since Kotlin 42.33 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.4 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:3:17: error: 'typealias TA = String' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.4 fun test(a: A): TA { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.3. This declaration is only supported since Kotlin 42.33 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.4. This declaration is only supported since Kotlin 42.33 f() ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.4 f() ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:4:5: error: 'f(): Unit' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.4 f() ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.3. This declaration is only supported since Kotlin 42.33 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 42.33 and cannot be used in Kotlin 1.4. This declaration is only supported since Kotlin 42.33 return p ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 40.34 and cannot be used in Kotlin 1.4 return p ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlin/source.kt:5:12: error: 'p: String' is only available since Kotlin 45.35 and cannot be used in Kotlin 1.4 return p ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/output.txt index 1345baa388c..4c3ea728286 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/output.txt @@ -1,7 +1,7 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.4 fun test(a: Outer.Nested) { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.4 a.f() ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/output.txt index 5eac96a5a9c..bb6546a03bb 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/output.txt @@ -1,7 +1,7 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.4 fun test(a: Outer.Nested) { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.4 a.f() ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/output.txt index 23dad959101..ec228e52b40 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/output.txt @@ -1,7 +1,7 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.4 fun test(a: Outer.Nested) { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.4 a.f() ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/output.txt index b60d5b88406..e6ec5c811bd 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/output.txt @@ -1,7 +1,7 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.4 fun test(a: Outer.Nested) { ^ -compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.3 +compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.4 a.f() ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/library/typeAliases.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/library/typeAliases.kt deleted file mode 100644 index cebf94074ef..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/library/typeAliases.kt +++ /dev/null @@ -1,11 +0,0 @@ -package test - -typealias Str = String -typealias L = List - -class Klass { - @Suppress("TOPLEVEL_TYPEALIASES_ONLY") - typealias Nested = Z - - class Z -} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt deleted file mode 100644 index d22cda1a673..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt +++ /dev/null @@ -1,8 +0,0 @@ -import test.* -import test.Str - -fun use( - str: Str, - l: L, - nested: Klass.Nested -) {} diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt deleted file mode 100644 index c5a2ddfbee5..00000000000 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt +++ /dev/null @@ -1,17 +0,0 @@ -warning: language version 1.0 is deprecated and its support will be removed in a future version of Kotlin -compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:2:13: error: unresolved reference: Str -import test.Str - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:5:14: error: unresolved reference: Str - str: Str, - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:6:12: error: unresolved reference: L - l: L, - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:6:14: error: unresolved reference: Str - l: L, - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:7:23: error: unresolved reference: Nested - nested: Klass.Nested - ^ -COMPILATION_ERROR diff --git a/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected b/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected index 6f40c3f5ef6..3977f5a2854 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected +++ b/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected @@ -3,9 +3,9 @@ Buildfile: [TestData]/build.xml build: [kotlinc] Compiling [[TestData]/main.kt] => [[Temp]/hello.jar] - [kotlinc] [TestData]/main.kt:2:5: error: members are not allowed in annotation class - [kotlinc] class Nested - [kotlinc] ^ + [kotlinc] [TestData]/main.kt:4:21: error: 'break' and 'continue' are not allowed in 'when' statements. Consider using labels to continue/break from the outer loop + [kotlinc] true -> break + [kotlinc] ^ ERR: diff --git a/compiler/testData/integration/ant/jvm/languageVersion/build.xml b/compiler/testData/integration/ant/jvm/languageVersion/build.xml index 83261e872c7..afe98b29f27 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/build.xml +++ b/compiler/testData/integration/ant/jvm/languageVersion/build.xml @@ -3,7 +3,7 @@ - + diff --git a/compiler/testData/integration/ant/jvm/languageVersion/main.kt b/compiler/testData/integration/ant/jvm/languageVersion/main.kt index e8b6308fec6..51b3d3b4bdd 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/main.kt +++ b/compiler/testData/integration/ant/jvm/languageVersion/main.kt @@ -1,3 +1,7 @@ -annotation class Outer { - class Nested +fun test() { + while (true) { + when { + true -> break + } + } } diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java index b3ae25e636e..9c88429404a 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -30,16 +30,16 @@ public class CliTestGenerated extends AbstractCliTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/cli/jvm"), Pattern.compile("^(.+)\\.args$"), null, false); } + @TestMetadata("apiAndLanguageVersionsUnsupported.args") + public void testApiAndLanguageVersionsUnsupported() throws Exception { + runTest("compiler/testData/cli/jvm/apiAndLanguageVersionsUnsupported.args"); + } + @TestMetadata("apiVersion.args") public void testApiVersion() throws Exception { runTest("compiler/testData/cli/jvm/apiVersion.args"); } - @TestMetadata("apiVersion1.0.args") - public void testApiVersion1_0() throws Exception { - runTest("compiler/testData/cli/jvm/apiVersion1.0.args"); - } - @TestMetadata("apiVersionAndSinceNewerKotlin.args") public void testApiVersionAndSinceNewerKotlin() throws Exception { runTest("compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args"); @@ -65,6 +65,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.args"); } + @TestMetadata("apiVersionUnsupported.args") + public void testApiVersionUnsupported() throws Exception { + runTest("compiler/testData/cli/jvm/apiVersionUnsupported.args"); + } + @TestMetadata("argfileWithEmptyArgument.args") public void testArgfileWithEmptyArgument() throws Exception { runTest("compiler/testData/cli/jvm/argfileWithEmptyArgument.args"); @@ -160,6 +165,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/deprecatedApiVersion.args"); } + @TestMetadata("deprecatedLanguageUnsupportedApi.args") + public void testDeprecatedLanguageUnsupportedApi() throws Exception { + runTest("compiler/testData/cli/jvm/deprecatedLanguageUnsupportedApi.args"); + } + @TestMetadata("deprecatedLanguageVersion.args") public void testDeprecatedLanguageVersion() throws Exception { runTest("compiler/testData/cli/jvm/deprecatedLanguageVersion.args"); @@ -170,6 +180,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/diagnosticsOrder.args"); } + @TestMetadata("disabledFeatureFromUnsupportedVersion.args") + public void testDisabledFeatureFromUnsupportedVersion() throws Exception { + runTest("compiler/testData/cli/jvm/disabledFeatureFromUnsupportedVersion.args"); + } + @TestMetadata("duplicateSources.args") public void testDuplicateSources() throws Exception { runTest("compiler/testData/cli/jvm/duplicateSources.args"); @@ -480,6 +495,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/languageVersionInvalid.args"); } + @TestMetadata("languageVersionUnsupported.args") + public void testLanguageVersionUnsupported() throws Exception { + runTest("compiler/testData/cli/jvm/languageVersionUnsupported.args"); + } + @TestMetadata("legacySmartCastsAfterTry.args") public void testLegacySmartCastsAfterTry() throws Exception { runTest("compiler/testData/cli/jvm/legacySmartCastsAfterTry.args"); @@ -645,16 +665,16 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/unknownExtraFlags.args"); } - @TestMetadata("unsupportedTypeAlias.args") - public void testUnsupportedTypeAlias() throws Exception { - runTest("compiler/testData/cli/jvm/unsupportedTypeAlias.args"); - } - @TestMetadata("useMixedNamedArgumentsFlag.args") public void testUseMixedNamedArgumentsFlag() throws Exception { runTest("compiler/testData/cli/jvm/useMixedNamedArgumentsFlag.args"); } + @TestMetadata("variableInWhenSubject.args") + public void testVariableInWhenSubject() throws Exception { + runTest("compiler/testData/cli/jvm/variableInWhenSubject.args"); + } + @TestMetadata("warningJdkWithNoJdk.args") public void testWarningJdkWithNoJdk() throws Exception { runTest("compiler/testData/cli/jvm/warningJdkWithNoJdk.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index c3970904281..dc8d2a372a5 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -448,15 +448,6 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration compileKotlin("main.kt", tmpdir, listOf(library)) } - fun testTypeAliasesAreInvisibleInCompatibilityMode() { - val library = compileLibrary("library") - // -Xskip-metadata-version-check because if master is pre-release, an extra error will be reported when compiling with LV 1.0 - // against a library compiled by a pre-release compiler - compileKotlin( - "main.kt", tmpdir, listOf(library), K2JVMCompiler(), listOf("-language-version", "1.0", "-Xskip-metadata-version-check") - ) - } - fun testInnerClassPackageConflict() { val output = compileLibrary("library", destination = File(tmpdir, "library")) File(testDataDirectory, "library/test/Foo/x.txt").copyTo(File(output, "test/Foo/x.txt")) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index debbc53970b..44ac264b26d 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -248,6 +248,12 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware { val isStable: Boolean get() = this <= LATEST_STABLE + val isDeprecated: Boolean + get() = this >= OLDEST_DEPRECATED && this < FIRST_SUPPORTED + + val isUnsupported: Boolean + get() = this < OLDEST_DEPRECATED + val versionString: String get() = "$major.$minor" @@ -265,7 +271,10 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware { str.split(".", "-").let { if (it.size >= 2) fromVersionString("${it[0]}.${it[1]}") else null } @JvmField - val FIRST_SUPPORTED = KOTLIN_1_2 + val OLDEST_DEPRECATED = KOTLIN_1_2 + + @JvmField + val FIRST_SUPPORTED = KOTLIN_1_3 @JvmField val LATEST_STABLE = KOTLIN_1_4