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
This commit is contained in:
Pavel Kirpichenkov
2020-01-27 17:06:08 +03:00
parent 715e7e1a3c
commit 913ed71863
75 changed files with 337 additions and 305 deletions
@@ -426,6 +426,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
private fun HashMap<LanguageFeature, LanguageFeature.State>.configureLanguageFeaturesFromInternalArgs(collector: MessageCollector) { private fun HashMap<LanguageFeature, LanguageFeature.State>.configureLanguageFeaturesFromInternalArgs(collector: MessageCollector) {
val featuresThatForcePreReleaseBinaries = mutableListOf<LanguageFeature>() val featuresThatForcePreReleaseBinaries = mutableListOf<LanguageFeature>()
val disabledFeaturesFromUnsupportedVersions = mutableListOf<LanguageFeature>()
var standaloneSamConversionFeaturePassedExplicitly = false var standaloneSamConversionFeaturePassedExplicitly = false
var functionReferenceWithDefaultValueFeaturePassedExplicitly = false var functionReferenceWithDefaultValueFeaturePassedExplicitly = false
@@ -435,6 +436,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
featuresThatForcePreReleaseBinaries += feature featuresThatForcePreReleaseBinaries += feature
} }
if (state == LanguageFeature.State.DISABLED && feature.sinceVersion?.isUnsupported == true) {
disabledFeaturesFromUnsupportedVersions += feature
}
when (feature) { when (feature) {
LanguageFeature.SamConversionPerArgument -> LanguageFeature.SamConversionPerArgument ->
standaloneSamConversionFeaturePassedExplicitly = true standaloneSamConversionFeaturePassedExplicitly = true
@@ -460,6 +465,14 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
"Following manually enabled features will force generation of pre-release binaries: ${featuresThatForcePreReleaseBinaries.joinToString()}" "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 { fun toLanguageVersionSettings(collector: MessageCollector): LanguageVersionSettings {
@@ -471,32 +484,77 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
// (API version cannot be greater than the language version) // (API version cannot be greater than the language version)
val apiVersion = parseVersion(collector, apiVersion, "API") ?: languageVersion 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) { if (apiVersion > languageVersion) {
collector.report( collector.report(
CompilerMessageSeverity.ERROR, CompilerMessageSeverity.ERROR,
"-api-version (${apiVersion.versionString}) cannot be greater than -language-version (${languageVersion.versionString})" "-api-version (${apiVersion.versionString}) cannot be greater than -language-version (${languageVersion.versionString})"
) )
} }
}
private fun checkLanguageVersionIsStable(languageVersion: LanguageVersion, collector: MessageCollector) {
if (!languageVersion.isStable) { if (!languageVersion.isStable) {
collector.report( collector.report(
CompilerMessageSeverity.STRONG_WARNING, 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 { private fun checkOutdatedVersions(language: LanguageVersion, api: LanguageVersion, collector: MessageCollector) {
languageVersion < LanguageVersion.FIRST_SUPPORTED -> "Language version ${languageVersion.versionString}" val (version, versionKind) = findOutdatedVersion(language, api) ?: return
apiVersion < LanguageVersion.FIRST_SUPPORTED -> "API version ${apiVersion.versionString}" 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<LanguageVersion, VersionKind>? {
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 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) { if (progressiveMode && languageVersion < LanguageVersion.LATEST_STABLE) {
collector.report( collector.report(
CompilerMessageSeverity.STRONG_WARNING, CompilerMessageSeverity.STRONG_WARNING,
@@ -506,14 +564,9 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
"or turning off progressive mode." "or turning off progressive mode."
) )
} }
}
val languageVersionSettings = LanguageVersionSettingsImpl( private fun checkCoroutines(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
languageVersion,
ApiVersion.createByLanguageVersion(apiVersion),
configureAnalysisFlags(collector),
configureLanguageFeatures(collector)
)
if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) { if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) {
if (coroutinesState != DEFAULT) { if (coroutinesState != DEFAULT) {
collector.report( 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? = private fun parseVersion(collector: MessageCollector, value: String?, versionOf: String): LanguageVersion? =
if (value == null) null if (value == null) null
else LanguageVersion.fromVersionString(value) else LanguageVersion.fromVersionString(value)
?: run { ?: run {
val versionStrings = LanguageVersion.values().map(LanguageVersion::description) val versionStrings = LanguageVersion.values().map(LanguageVersion::description)
val message = "Unknown $versionOf version: $value\nSupported $versionOf versions: ${versionStrings.joinToString(", ")}" val message = "Unknown $versionOf version: $value\nSupported $versionOf versions: ${versionStrings.joinToString(", ")}"
collector.report(CompilerMessageSeverity.ERROR, message, null) collector.report(CompilerMessageSeverity.ERROR, message, null)
null null
} }
// Used only for serialize and deserialize settings. Don't use in other places! // Used only for serialize and deserialize settings. Don't use in other places!
class DummyImpl : CommonCompilerArguments() class DummyImpl : CommonCompilerArguments()
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
-output -output
$TEMP_DIR$/out.js $TEMP_DIR$/out.js
-language-version -language-version
1.2 1.3
+6 -2
View File
@@ -1,5 +1,9 @@
package test package test
annotation class Outer { fun test() {
class Nested while (true) {
when {
true -> break
}
}
} }
+3 -3
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/js/languageVersion.kt:4:5: error: members are not allowed in annotation class 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
class Nested true -> break
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -0,0 +1,7 @@
$TESTDATA_DIR$/apiAndLanguageVersionsUnsupported.kt
-d
$TEMP_DIR$
-language-version
1.1
-api-version
1.0
@@ -0,0 +1 @@
class Test
@@ -0,0 +1,2 @@
error: language version 1.1 is no longer supported; please, use version 1.2 or greater.
COMPILATION_ERROR
+13 -2
View File
@@ -1,3 +1,14 @@
fun test() { class A
""::class.sealedSubclasses
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)
} }
+7 -3
View File
@@ -1,4 +1,8 @@
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin
""::class.sealedSubclasses 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 COMPILATION_ERROR
-7
View File
@@ -1,7 +0,0 @@
$TESTDATA_DIR$/apiVersion1.0.kt
-d
$TEMP_DIR$
-language-version
1.1
-api-version
1.0
-16
View File
@@ -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 { "" }
}
-14
View File
@@ -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
@@ -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 compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.2
@SinceKotlin("1.3") @SinceKotlin("1.3")
^ ^
@@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-api-version -api-version
1.3 1.4
-language-version -language-version
1.2 1.3
@@ -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 COMPILATION_ERROR
+7 -3
View File
@@ -1,4 +1,8 @@
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin
""::class.sealedSubclasses 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 COMPILATION_ERROR
@@ -1,4 +1,8 @@
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin
""::class.sealedSubclasses 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 COMPILATION_ERROR
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/apiVersionUnsupported.kt
-d
$TEMP_DIR$
-api-version
1.1
+1
View File
@@ -0,0 +1 @@
class Test
+2
View File
@@ -0,0 +1,2 @@
error: API version 1.1 is no longer supported; please, use version 1.2 or greater.
COMPILATION_ERROR
+7 -3
View File
@@ -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: -Xdouble ' quote ' escaped " sequence /
warning: flag is not supported by this version of the compiler: -Xsingle " 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 warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin
""::class.sealedSubclasses 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 COMPILATION_ERROR
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-api-version -api-version
1.1 1.2
+1 -1
View File
@@ -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 OK
@@ -0,0 +1,7 @@
$TESTDATA_DIR$/deprecatedLanguageUnsupportedApi.kt
-d
$TEMP_DIR$
-language-version
1.2
-api-version
1.1
@@ -0,0 +1 @@
class Test
@@ -0,0 +1,2 @@
error: API version 1.1 is no longer supported; please, use version 1.2 or greater.
COMPILATION_ERROR
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-language-version -language-version
1.1 1.2
+1 -1
View File
@@ -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 OK
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/disabledFeatureInUnsupportedVersion.kt
-XXLanguage\:-TypeAliases
-XXLanguage\:-BoundCallableReferences
-d
$TEMP_DIR$
@@ -0,0 +1 @@
class Test
@@ -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
@@ -1,6 +1,6 @@
$TESTDATA_DIR$/legacySmartCastsAfterTry.kt $TESTDATA_DIR$/variableInWhenSubject.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-language-version -language-version
1.1 1.2
-XXLanguage\:+SoundSmartCastsAfterTry -XXLanguage\:+VariableDeclarationInWhenSubject
@@ -1,14 +1,11 @@
warning: ATTENTION! warning: ATTENTION!
This build uses unsafe internal compiler arguments: This build uses unsafe internal compiler arguments:
-XXLanguage:+SoundSmartCastsAfterTry -XXLanguage:+VariableDeclarationInWhenSubject
This mode is not recommended for production use, This mode is not recommended for production use,
as no stability/compatibility guarantees are given on as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! 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 warning: language version 1.2 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? OK
some.length
^
COMPILATION_ERROR
@@ -2,5 +2,5 @@ $TESTDATA_DIR$/simple.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-language-version -language-version
1.2 1.3
-XXLanguage\:+ProhibitDataClassesOverridingCopy -XXLanguage\:+RestrictReturnStatementTarget
+1
View File
@@ -1 +1,2 @@
warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin
OK OK
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-language-version -language-version
1.2 1.3
+6 -2
View File
@@ -1,5 +1,9 @@
package test package test
annotation class Outer { fun test() {
class Nested while (true) {
when {
true -> break
}
}
} }
+3 -3
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/languageVersion.kt:4:5: error: members are not allowed in annotation class 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
class Nested true -> break
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/languageVersionUnsupported.kt
-d
$TEMP_DIR$
-language-version
1.1
@@ -0,0 +1 @@
class Test
@@ -0,0 +1,2 @@
error: language version 1.1 is no longer supported; please, use version 1.2 or greater.
COMPILATION_ERROR
+7 -3
View File
@@ -1,4 +1,8 @@
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses warning: API version 1.2 is deprecated and its support will be removed in a future version of Kotlin
""::class.sealedSubclasses 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 COMPILATION_ERROR
@@ -1,5 +0,0 @@
interface WithCopy<T> {
fun copy(str: T): WithCopy<T>
}
data class Test(val str: String): WithCopy<String>
@@ -1,6 +0,0 @@
val nonConstArray = longArrayOf(0)
annotation class Anno(vararg val value: Long)
@Anno(value = nonConstArray)
fun foo1() {}
@@ -0,0 +1,3 @@
open class A {
tailrec open fun foo(x: Int) {}
}
@@ -0,0 +1,3 @@
fun test() {
val x = object<T> { }
}
@@ -1,5 +0,0 @@
val my: Int = 1
get() {
field++
return field
}
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/progressive
-d -d
$TEMP_DIR$ $TEMP_DIR$
-language-version -language-version
1.2 1.3
+11 -8
View File
@@ -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' compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: warning: a function is marked as tail-recursive but no tail calls are found
data class Test(val str: String): WithCopy<String> tailrec open fun foo(x: Int) {}
^ ^
compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt:5:15: warning: an annotation argument must be a compile-time constant compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: warning: tailrec on open members is deprecated
@Anno(value = nonConstArray) tailrec open fun foo(x: Int) {}
^ ^
compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt:3:9: warning: reassignment of read-only property via backing field is deprecated compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:9: warning: variable 'x' is never used
field++ val x = object<T> { }
^ ^
compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:19: warning: type parameters for anonymous objects are deprecated
val x = object<T> { }
^
OK OK
+6 -9
View File
@@ -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' compiler/testData/cli/jvm/progressive/tailrecOnVirtualMember.kt:2:5: error: tailrec is not allowed on open members
data class Test(val str: String): WithCopy<String> tailrec open fun foo(x: Int) {}
^ ^
compiler/testData/cli/jvm/progressive/nonConstValueAsVarargInAnnotation.kt:5:15: error: an annotation argument must be a compile-time constant compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:19: error: type parameters are not allowed for objects
@Anno(value = nonConstArray) val x = object<T> { }
^ ^
compiler/testData/cli/jvm/progressive/valReassignmentViaBackingField.kt:3:9: error: reassignment of read-only property via backing field
field++
^
COMPILATION_ERROR COMPILATION_ERROR
@@ -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] 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() {} suspend fun dummy() {}
^ ^
-5
View File
@@ -1,5 +0,0 @@
-language-version
1.0
$TESTDATA_DIR$/unsupportedTypeAlias.kt
-d
$TEMP_DIR$
-3
View File
@@ -1,3 +0,0 @@
package test
typealias Unused = String
-5
View File
@@ -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
+6
View File
@@ -0,0 +1,6 @@
$TESTDATA_DIR$/variableInWhenSubject.kt
-d
$TEMP_DIR$
-language-version
1.2
-XXLanguage\:+VariableDeclarationInWhenSubject
+5
View File
@@ -0,0 +1,5 @@
fun test(s: String?) =
when (val v = s) {
null -> ""
else -> v
}
+11
View File
@@ -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
@@ -1,31 +0,0 @@
package library
import kotlin.coroutines.experimental.*
var continuation: Continuation<Unit>? = 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<Unit> { continuation = it }
}
suspend fun bar() {
append("(bar)")
return suspendCoroutine<Unit> { continuation = it }
}
fun resumeLibrary() {
continuation?.let {
continuation = null
it.resume(Unit)
}
}
@@ -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<Unit> {
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<String> {
val result = runBlockingLibrary {
test()
}
return arrayOf("[foo](foo)(block)[bar](bar)[test]:resumes=2", result)
}
@@ -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 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() dummy()
^ ^
@@ -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 { 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 { 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 { 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 { 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 { 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 { 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() 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() 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() 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 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 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 return p
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -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) { 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() a.f()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -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) { 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() a.f()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -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) { 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() a.f()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -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) { 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() a.f()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -1,11 +0,0 @@
package test
typealias Str = String
typealias L<T> = List<T>
class Klass {
@Suppress("TOPLEVEL_TYPEALIASES_ONLY")
typealias Nested = Z
class Z
}
@@ -1,8 +0,0 @@
import test.*
import test.Str
fun use(
str: Str,
l: L<Str>,
nested: Klass.Nested
) {}
@@ -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<Str>,
^
compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:6:14: error: unresolved reference: Str
l: L<Str>,
^
compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:7:23: error: unresolved reference: Nested
nested: Klass.Nested
^
COMPILATION_ERROR
@@ -3,9 +3,9 @@ Buildfile: [TestData]/build.xml
build: build:
[kotlinc] Compiling [[TestData]/main.kt] => [[Temp]/hello.jar] [kotlinc] Compiling [[TestData]/main.kt] => [[Temp]/hello.jar]
[kotlinc] [TestData]/main.kt:2:5: error: members are not allowed in annotation class [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] class Nested [kotlinc] true -> break
[kotlinc] ^ [kotlinc] ^
ERR: ERR:
@@ -3,7 +3,7 @@
<target name="build"> <target name="build">
<kotlinc src="${test.data}/main.kt" output="${temp}/hello.jar"> <kotlinc src="${test.data}/main.kt" output="${temp}/hello.jar">
<compilerarg line="-language-version 1.2"/> <compilerarg line="-language-version 1.3"/>
</kotlinc> </kotlinc>
</target> </target>
</project> </project>
@@ -1,3 +1,7 @@
annotation class Outer { fun test() {
class Nested while (true) {
when {
true -> break
}
}
} }
+30 -10
View File
@@ -30,16 +30,16 @@ public class CliTestGenerated extends AbstractCliTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/cli/jvm"), Pattern.compile("^(.+)\\.args$"), null, false); 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") @TestMetadata("apiVersion.args")
public void testApiVersion() throws Exception { public void testApiVersion() throws Exception {
runTest("compiler/testData/cli/jvm/apiVersion.args"); 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") @TestMetadata("apiVersionAndSinceNewerKotlin.args")
public void testApiVersionAndSinceNewerKotlin() throws Exception { public void testApiVersionAndSinceNewerKotlin() throws Exception {
runTest("compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args"); runTest("compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args");
@@ -65,6 +65,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.args"); 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") @TestMetadata("argfileWithEmptyArgument.args")
public void testArgfileWithEmptyArgument() throws Exception { public void testArgfileWithEmptyArgument() throws Exception {
runTest("compiler/testData/cli/jvm/argfileWithEmptyArgument.args"); runTest("compiler/testData/cli/jvm/argfileWithEmptyArgument.args");
@@ -160,6 +165,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/deprecatedApiVersion.args"); 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") @TestMetadata("deprecatedLanguageVersion.args")
public void testDeprecatedLanguageVersion() throws Exception { public void testDeprecatedLanguageVersion() throws Exception {
runTest("compiler/testData/cli/jvm/deprecatedLanguageVersion.args"); runTest("compiler/testData/cli/jvm/deprecatedLanguageVersion.args");
@@ -170,6 +180,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/diagnosticsOrder.args"); 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") @TestMetadata("duplicateSources.args")
public void testDuplicateSources() throws Exception { public void testDuplicateSources() throws Exception {
runTest("compiler/testData/cli/jvm/duplicateSources.args"); runTest("compiler/testData/cli/jvm/duplicateSources.args");
@@ -480,6 +495,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/languageVersionInvalid.args"); 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") @TestMetadata("legacySmartCastsAfterTry.args")
public void testLegacySmartCastsAfterTry() throws Exception { public void testLegacySmartCastsAfterTry() throws Exception {
runTest("compiler/testData/cli/jvm/legacySmartCastsAfterTry.args"); runTest("compiler/testData/cli/jvm/legacySmartCastsAfterTry.args");
@@ -645,16 +665,16 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/unknownExtraFlags.args"); 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") @TestMetadata("useMixedNamedArgumentsFlag.args")
public void testUseMixedNamedArgumentsFlag() throws Exception { public void testUseMixedNamedArgumentsFlag() throws Exception {
runTest("compiler/testData/cli/jvm/useMixedNamedArgumentsFlag.args"); 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") @TestMetadata("warningJdkWithNoJdk.args")
public void testWarningJdkWithNoJdk() throws Exception { public void testWarningJdkWithNoJdk() throws Exception {
runTest("compiler/testData/cli/jvm/warningJdkWithNoJdk.args"); runTest("compiler/testData/cli/jvm/warningJdkWithNoJdk.args");
@@ -448,15 +448,6 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
compileKotlin("main.kt", tmpdir, listOf(library)) 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() { fun testInnerClassPackageConflict() {
val output = compileLibrary("library", destination = File(tmpdir, "library")) val output = compileLibrary("library", destination = File(tmpdir, "library"))
File(testDataDirectory, "library/test/Foo/x.txt").copyTo(File(output, "test/Foo/x.txt")) File(testDataDirectory, "library/test/Foo/x.txt").copyTo(File(output, "test/Foo/x.txt"))
@@ -248,6 +248,12 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware {
val isStable: Boolean val isStable: Boolean
get() = this <= LATEST_STABLE get() = this <= LATEST_STABLE
val isDeprecated: Boolean
get() = this >= OLDEST_DEPRECATED && this < FIRST_SUPPORTED
val isUnsupported: Boolean
get() = this < OLDEST_DEPRECATED
val versionString: String val versionString: String
get() = "$major.$minor" 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 } str.split(".", "-").let { if (it.size >= 2) fromVersionString("${it[0]}.${it[1]}") else null }
@JvmField @JvmField
val FIRST_SUPPORTED = KOTLIN_1_2 val OLDEST_DEPRECATED = KOTLIN_1_2
@JvmField
val FIRST_SUPPORTED = KOTLIN_1_3
@JvmField @JvmField
val LATEST_STABLE = KOTLIN_1_4 val LATEST_STABLE = KOTLIN_1_4