Report a warning or error if an old language version or API version is used
#KT-25823 Fixed
This commit is contained in:
committed by
Ilya Gorbunov
parent
db29eadba5
commit
02a9b03007
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
|
||||
-output
|
||||
$TEMP_DIR$/out.js
|
||||
-language-version
|
||||
1.0
|
||||
1.2
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
sealed class Base
|
||||
|
||||
class Derived : Base()
|
||||
annotation class Outer {
|
||||
class Nested
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
compiler/testData/cli/js/languageVersion.kt:5:17: error: this type is sealed, so it can be inherited by only its own nested classes or objects
|
||||
class Derived : Base()
|
||||
^
|
||||
compiler/testData/cli/js/languageVersion.kt:4:5: error: members are not allowed in annotation class
|
||||
class Nested
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/apiVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.0
|
||||
1.2
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
fun test() {
|
||||
""::class.isInstance(42)
|
||||
""::class.sealedSubclasses
|
||||
}
|
||||
|
||||
+3
-6
@@ -1,7 +1,4 @@
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses
|
||||
""::class.sealedSubclasses
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
COMPILATION_ERROR
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
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() {
|
||||
^
|
||||
@@ -10,4 +11,4 @@ compiler/testData/cli/jvm/apiVersion1.0.kt:10:5: error: the feature "bound calla
|
||||
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
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/apiVersionAndSinceNewerKotlin.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.0
|
||||
1.2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@SinceKotlin("1.0")
|
||||
@SinceKotlin("1.2")
|
||||
fun old() {}
|
||||
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.3")
|
||||
fun new() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.0
|
||||
@SinceKotlin("1.1")
|
||||
compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.2
|
||||
@SinceKotlin("1.3")
|
||||
^
|
||||
OK
|
||||
|
||||
@@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.1
|
||||
1.3
|
||||
-language-version
|
||||
1.0
|
||||
1.2
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
error: -api-version (1.1) cannot be greater than -language-version (1.0)
|
||||
error: -api-version (1.3) cannot be greater than -language-version (1.2)
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -1 +1 @@
|
||||
$TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version 1.0 -language-version 1.1
|
||||
$TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version 1.2 -language-version 1.3
|
||||
|
||||
@@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.0
|
||||
1.2
|
||||
-language-version
|
||||
1.1
|
||||
1.3
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses
|
||||
""::class.sealedSubclasses
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses
|
||||
""::class.sealedSubclasses
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
-X"some escaped \" sequence \\"
|
||||
$TESTDATA_DIR$/apiVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$ -api-version 1.0 -language-version 1.1
|
||||
$TEMP_DIR$ -api-version 1.2 -language-version 1.3
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
warning: flag is not supported by this version of the compiler: -Xsome escaped " sequence /
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses
|
||||
""::class.sealedSubclasses
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-api-version
|
||||
1.1
|
||||
@@ -0,0 +1,2 @@
|
||||
warning: API version 1.1 is deprecated and its support will be removed in a future version of Kotlin
|
||||
OK
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.1
|
||||
@@ -0,0 +1,2 @@
|
||||
warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin
|
||||
OK
|
||||
@@ -7,6 +7,7 @@ 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
|
||||
^
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.0
|
||||
1.2
|
||||
|
||||
+2
-6
@@ -1,9 +1,5 @@
|
||||
package test
|
||||
|
||||
sealed class Base
|
||||
|
||||
class Derived : Base()
|
||||
|
||||
fun test() {
|
||||
""::class.isInstance(42)
|
||||
annotation class Outer {
|
||||
class Nested
|
||||
}
|
||||
|
||||
+3
-9
@@ -1,10 +1,4 @@
|
||||
compiler/testData/cli/jvm/languageVersion.kt:5:17: error: this type is sealed, so it can be inherited by only its own nested classes or objects
|
||||
class Derived : Base()
|
||||
^
|
||||
compiler/testData/cli/jvm/languageVersion.kt:8:5: error: the feature "bound callable references" is only available since language version 1.1
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/languageVersion.kt:4:5: error: members are not allowed in annotation class
|
||||
class Nested
|
||||
^
|
||||
compiler/testData/cli/jvm/languageVersion.kt:8:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -1 +1 @@
|
||||
$TEMP_DIR$ -api-version 1.0 -language-version 1.1
|
||||
$TEMP_DIR$ -api-version 1.2 -language-version 1.3
|
||||
@@ -1,7 +1,4 @@
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1
|
||||
""::class.isInstance(42)
|
||||
^
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance
|
||||
""::class.isInstance(42)
|
||||
compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses
|
||||
""::class.sealedSubclasses
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
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
|
||||
COMPILATION_ERROR
|
||||
|
||||
Reference in New Issue
Block a user