[Compiler CLI] Implement reading language version settings from environment variable

^KT-51306 Fixed
This commit is contained in:
Victor Petukhov
2022-02-15 11:48:28 +03:00
committed by teamcity
parent 43a0876c26
commit 683a3e74a0
27 changed files with 175 additions and 7 deletions
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/appendingArgs.kt
-d
$TEMP_DIR$
-Xallow-kotlin-package
@@ -0,0 +1 @@
-Xrender-internal-diagnostic-names
@@ -0,0 +1,5 @@
package kotlin
fun main() {
val x = 1?.dec()
}
@@ -0,0 +1,10 @@
compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt:4:9: warning: [UNUSED_VARIABLE] Variable 'x' is never used
val x = 1?.dec()
^
compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt:4:13: warning: [SAFE_CALL_WILL_CHANGE_NULLABILITY] Safe call on a non-null receiver will have nullable type in future releases
val x = 1?.dec()
^
compiler/testData/cli/jvm/readingConfigFromEnvironment/appendingArgs.kt:4:14: warning: [UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Int
val x = 1?.dec()
^
OK
@@ -0,0 +1,4 @@
public class Annotated {
@org.jetbrains.annotations.Nullable
public static String bar() { return ""; }
}
@@ -0,0 +1,6 @@
$TESTDATA_DIR$/overridingArgs.kt
$TESTDATA_DIR$/java
$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
-Xnullability-annotations=@org.jetbrains.annotations\:warn
@@ -0,0 +1 @@
-Xnullability-annotations=@org.jetbrains.annotations:ignore
@@ -0,0 +1,3 @@
fun main() {
Annotated.bar().length
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/overridingLv.kt
-d
$TEMP_DIR$
-language-version
1.7
@@ -0,0 +1,2 @@
-language-version
1.1
@@ -0,0 +1,3 @@
fun main() {
}
@@ -0,0 +1,2 @@
error: language version 1.1 is no longer supported; please, use version 1.3 or greater.
COMPILATION_ERROR
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/overridingXx.kt
-d
$TEMP_DIR$
-XXLanguage\:+ApproximateIntegerLiteralTypesInReceiverPosition
@@ -0,0 +1 @@
-XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition
@@ -0,0 +1,3 @@
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
const val cacheSize: Long = 4096 * 4
@@ -0,0 +1,13 @@
warning: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition
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!
compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:1:9: warning: parameter 'ttlMillis' is never used
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
^
OK
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/simple.kt
-d
$TEMP_DIR$
@@ -0,0 +1 @@
-Xrender-internal-diagnostic-names
@@ -0,0 +1,3 @@
fun main() {
val x = 1 + ""
}
@@ -0,0 +1,10 @@
compiler/testData/cli/jvm/readingConfigFromEnvironment/simple.kt:2:15: error: [NONE_APPLICABLE] None of the following functions can be called with the arguments supplied:
public final operator fun plus(other: Byte): Int defined in kotlin.Int
public final operator fun plus(other: Double): Double defined in kotlin.Int
public final operator fun plus(other: Float): Float defined in kotlin.Int
public final operator fun plus(other: Int): Int defined in kotlin.Int
public final operator fun plus(other: Long): Long defined in kotlin.Int
public final operator fun plus(other: Short): Int defined in kotlin.Int
val x = 1 + ""
^
COMPILATION_ERROR