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:
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
|
||||
-output
|
||||
$TEMP_DIR$/out.js
|
||||
-language-version
|
||||
1.2
|
||||
1.3
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
package test
|
||||
|
||||
annotation class Outer {
|
||||
class Nested
|
||||
fun test() {
|
||||
while (true) {
|
||||
when {
|
||||
true -> break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
+7
-3
@@ -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
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
$TESTDATA_DIR$/apiVersion1.0.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.1
|
||||
-api-version
|
||||
1.0
|
||||
-16
@@ -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
@@ -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
|
||||
@SinceKotlin("1.3")
|
||||
^
|
||||
|
||||
@@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.3
|
||||
1.4
|
||||
-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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/apiVersionUnsupported.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-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
|
||||
+7
-3
@@ -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
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.1
|
||||
1.2
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.1
|
||||
1.2
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.1
|
||||
-XXLanguage\:+SoundSmartCastsAfterTry
|
||||
1.2
|
||||
-XXLanguage\:+VariableDeclarationInWhenSubject
|
||||
@@ -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
|
||||
|
||||
@@ -2,5 +2,5 @@ $TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.2
|
||||
-XXLanguage\:+ProhibitDataClassesOverridingCopy
|
||||
1.3
|
||||
-XXLanguage\:+RestrictReturnStatementTarget
|
||||
|
||||
+1
@@ -1 +1,2 @@
|
||||
warning: language version 1.2 is deprecated and its support will be removed in a future version of Kotlin
|
||||
OK
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.2
|
||||
1.3
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
package test
|
||||
|
||||
annotation class Outer {
|
||||
class Nested
|
||||
fun test() {
|
||||
while (true) {
|
||||
when {
|
||||
true -> break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/progressive
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.2
|
||||
1.3
|
||||
|
||||
+11
-8
@@ -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<String>
|
||||
^
|
||||
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<T> { }
|
||||
^
|
||||
compiler/testData/cli/jvm/progressive/typeParametersInAnonymousObjects.kt:2:19: warning: type parameters for anonymous objects are deprecated
|
||||
val x = object<T> { }
|
||||
^
|
||||
OK
|
||||
|
||||
+6
-9
@@ -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<String>
|
||||
^
|
||||
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<T> { }
|
||||
^
|
||||
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]
|
||||
suspend fun dummy() {}
|
||||
^
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
-language-version
|
||||
1.0
|
||||
$TESTDATA_DIR$/unsupportedTypeAlias.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -1,3 +0,0 @@
|
||||
package test
|
||||
|
||||
typealias Unused = String
|
||||
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
$TESTDATA_DIR$/variableInWhenSubject.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.2
|
||||
-XXLanguage\:+VariableDeclarationInWhenSubject
|
||||
@@ -0,0 +1,5 @@
|
||||
fun test(s: String?) =
|
||||
when (val v = s) {
|
||||
null -> ""
|
||||
else -> v
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user