Support -Xexperimental and -Xuse-experimental, validate their values
#KT-22759 In Progress
This commit is contained in:
+2
@@ -7,6 +7,7 @@ where advanced options include:
|
||||
-Xcoroutines={enable|warn|error}
|
||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
||||
-Xeffect-system Enable experimental language feature: effect system
|
||||
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
-Xmulti-platform Enable experimental language support for multi-platform projects
|
||||
@@ -18,6 +19,7 @@ where advanced options include:
|
||||
-Xrepeat=<count> Repeat compilation (for performance analysis)
|
||||
-Xreport-output-files Report source to output files mapping
|
||||
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
|
||||
-Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name
|
||||
|
||||
Advanced options are non-standard and may be changed or removed without any notice.
|
||||
OK
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
$TESTDATA_DIR$/experimentalAndUseExperimentalWithSameAnnotation.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xskip-runtime-version-check
|
||||
-language-version
|
||||
1.3
|
||||
-Xexperimental=org.test.ExperimentalAPI
|
||||
-Xuse-experimental=org.test.ExperimentalAPI
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.test
|
||||
|
||||
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.COMPILATION])
|
||||
annotation class ExperimentalAPI
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
error: '-Xuse-experimental=org.test.ExperimentalAPI' has no effect because '-Xexperimental=org.test.ExperimentalAPI' is used
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/experimentalIsNotAnnotation.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xexperimental=org.test.NotAnAnnotation1
|
||||
-Xuse-experimental=org.test.NotAnAnnotation2
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.test
|
||||
|
||||
enum class NotAnAnnotation1
|
||||
interface NotAnAnnotation2
|
||||
@@ -0,0 +1,3 @@
|
||||
error: class org.test.NotAnAnnotation1 is not an experimental API marker annotation
|
||||
error: class org.test.NotAnAnnotation2 is not an experimental API marker annotation
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/experimentalIsNotMarker.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xexperimental=org.test.NotAMarker1
|
||||
-Xuse-experimental=org.test.NotAMarker2
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.test
|
||||
|
||||
annotation class NotAMarker1
|
||||
annotation class NotAMarker2
|
||||
@@ -0,0 +1,3 @@
|
||||
error: class org.test.NotAMarker1 is not an experimental API marker annotation
|
||||
error: class org.test.NotAMarker2 is not an experimental API marker annotation
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,7 @@
|
||||
$TESTDATA_DIR$/experimentalNested.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xskip-runtime-version-check
|
||||
-language-version
|
||||
1.3
|
||||
-Xexperimental=org.test.Outer.Nested
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.test
|
||||
|
||||
class Outer {
|
||||
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.LINKAGE])
|
||||
annotation class Nested
|
||||
}
|
||||
|
||||
@Outer.Nested
|
||||
fun foo() {}
|
||||
@@ -0,0 +1,2 @@
|
||||
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
OK
|
||||
@@ -0,0 +1,8 @@
|
||||
$TESTDATA_DIR$/experimentalRuntimeScope.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xskip-runtime-version-check
|
||||
-language-version
|
||||
1.3
|
||||
-Xexperimental=org.test.Experimental1
|
||||
-Xuse-experimental=org.test.Experimental2
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.test
|
||||
|
||||
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.LINKAGE])
|
||||
annotation class Experimental1
|
||||
|
||||
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.RUNTIME])
|
||||
annotation class Experimental2
|
||||
@@ -0,0 +1,3 @@
|
||||
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
error: experimental API marker org.test.Experimental2 has impact other than COMPILATION, therefore it can't be used with -Xuse-experimental
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,6 @@
|
||||
$TESTDATA_DIR$/experimentalUnresolved.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xuse-experimental=org.test.Unresolved1
|
||||
-Xexperimental=org.test.Unresolved2
|
||||
-Xuse-experimental=org.test.Unresolved3
|
||||
@@ -0,0 +1 @@
|
||||
fun test() {}
|
||||
@@ -0,0 +1,4 @@
|
||||
error: experimental API marker org.test.Unresolved2 is unresolved. Please make sure it's present in the module dependencies
|
||||
error: experimental API marker org.test.Unresolved1 is unresolved. Please make sure it's present in the module dependencies
|
||||
error: experimental API marker org.test.Unresolved3 is unresolved. Please make sure it's present in the module dependencies
|
||||
COMPILATION_ERROR
|
||||
+2
@@ -44,6 +44,7 @@ where advanced options include:
|
||||
-Xcoroutines={enable|warn|error}
|
||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
||||
-Xeffect-system Enable experimental language feature: effect system
|
||||
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
-Xmulti-platform Enable experimental language support for multi-platform projects
|
||||
@@ -55,6 +56,7 @@ where advanced options include:
|
||||
-Xrepeat=<count> Repeat compilation (for performance analysis)
|
||||
-Xreport-output-files Report source to output files mapping
|
||||
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
|
||||
-Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name
|
||||
|
||||
Advanced options are non-standard and may be changed or removed without any notice.
|
||||
OK
|
||||
|
||||
Reference in New Issue
Block a user