Support -Xexperimental and -Xuse-experimental, validate their values

#KT-22759 In Progress
This commit is contained in:
Alexander Udalov
2018-01-02 16:46:07 +01:00
parent 153c86c069
commit 77625831f7
29 changed files with 204 additions and 10 deletions
+2
View File
@@ -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
@@ -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
@@ -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
+4
View File
@@ -0,0 +1,4 @@
package org.test
annotation class NotAMarker1
annotation class NotAMarker2
+3
View File
@@ -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
+7
View File
@@ -0,0 +1,7 @@
$TESTDATA_DIR$/experimentalNested.kt
-d
$TEMP_DIR$
-Xskip-runtime-version-check
-language-version
1.3
-Xexperimental=org.test.Outer.Nested
+9
View File
@@ -0,0 +1,9 @@
package org.test
class Outer {
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.LINKAGE])
annotation class Nested
}
@Outer.Nested
fun foo() {}
+2
View File
@@ -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
+7
View File
@@ -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
+6
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
fun test() {}
+4
View File
@@ -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
View File
@@ -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