Fix compiler and IDE tests on Experimental/RequiresOptIn

See cdbabf224f, e009c7064e
This commit is contained in:
Alexander Udalov
2019-12-18 14:07:48 +01:00
parent 830f0c6137
commit 16db3a8b5f
14 changed files with 50 additions and 35 deletions
@@ -1,7 +1,7 @@
compiler/testData/experimental/jsExperimentalModule/usage.kt:5:15: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@UseExperimental(lib.ExperimentalAPI::class)' compiler/testData/experimental/jsExperimentalModule/usage.kt:5:15: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@OptIn(lib.ExperimentalAPI::class)'
fun fail(foo: Foo) { fun fail(foo: Foo) {
^ ^
compiler/testData/experimental/jsExperimentalModule/usage.kt:6:5: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@UseExperimental(lib.ExperimentalAPI::class)' compiler/testData/experimental/jsExperimentalModule/usage.kt:6:5: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@OptIn(lib.ExperimentalAPI::class)'
bar() bar()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -1,7 +1,7 @@
compiler/testData/experimental/jvmExperimentalModule/usage.kt:5:15: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@UseExperimental(lib.ExperimentalAPI::class)' compiler/testData/experimental/jvmExperimentalModule/usage.kt:5:15: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@OptIn(lib.ExperimentalAPI::class)'
fun fail(foo: Foo) { fun fail(foo: Foo) {
^ ^
compiler/testData/experimental/jvmExperimentalModule/usage.kt:6:5: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@UseExperimental(lib.ExperimentalAPI::class)' compiler/testData/experimental/jvmExperimentalModule/usage.kt:6:5: error: this declaration is experimental and its usage must be marked with '@lib.ExperimentalAPI' or '@OptIn(lib.ExperimentalAPI::class)'
bar() bar()
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -2,10 +2,10 @@
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
// ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Bar' // ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Bar'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar' // ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to 'bar'
// ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments // ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)' // ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)' // ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
@Experimental @Experimental
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar'" "true" // "Add '@OptIn(MyExperimentalAPI::class)' annotation to 'bar'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar'" "true" // "Add '@OptIn(MyExperimentalAPI::class)' annotation to 'bar'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
@@ -14,7 +14,7 @@ class Some {
} }
class Bar { class Bar {
@UseExperimental(MyExperimentalAPI::class) @OptIn(MyExperimentalAPI::class)
fun bar() { fun bar() {
Some().foo() Some().foo()
} }
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(MyExperimentalAPI::class)' annotation to containing class 'Bar'" "true" // "Add '@OptIn(MyExperimentalAPI::class)' annotation to containing class 'Bar'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(MyExperimentalAPI::class)' annotation to containing class 'Bar'" "true" // "Add '@OptIn(MyExperimentalAPI::class)' annotation to containing class 'Bar'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
@@ -11,7 +11,7 @@ annotation class MyExperimentalAPI
@MyExperimentalAPI @MyExperimentalAPI
fun foo() {} fun foo() {}
@UseExperimental(MyExperimentalAPI::class) @OptIn(MyExperimentalAPI::class)
class Bar { class Bar {
fun bar() { fun bar() {
foo() foo()
+2 -2
View File
@@ -3,10 +3,10 @@
// WITH_RUNTIME // WITH_RUNTIME
// ACTION: Add '@MyExperimentalAPI' annotation to 'bar' // ACTION: Add '@MyExperimentalAPI' annotation to 'bar'
// ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Inner' // ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Inner'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar' // ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to 'bar'
// ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments // ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments
// ACTION: Introduce import alias // ACTION: Introduce import alias
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)' // ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
@Experimental @Experimental
annotation class MyExperimentalAPI annotation class MyExperimentalAPI
+2 -2
View File
@@ -2,8 +2,8 @@
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
// ACTION: Add '@MyExperimentalAPI' annotation to 'foo' // ACTION: Add '@MyExperimentalAPI' annotation to 'foo'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'foo' // ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to 'foo'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to containing class 'Derived' // ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to containing class 'Derived'
// ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments // ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments
// ERROR: This declaration overrides experimental member of supertype 'Base' and must be annotated with '@MyExperimentalAPI' // ERROR: This declaration overrides experimental member of supertype 'Base' and must be annotated with '@MyExperimentalAPI'
+2 -2
View File
@@ -1,6 +1,6 @@
// "Add '-Xuse-experimental=kotlin.Experimental' to module light_idea_test_case compiler arguments" "true" // "Add '-Xuse-experimental=kotlin.RequiresOptIn' to module light_idea_test_case compiler arguments" "true"
// COMPILER_ARGUMENTS: -version // COMPILER_ARGUMENTS: -version
// COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.RequiresOptIn
// DISABLE-ERRORS // DISABLE-ERRORS
// WITH_RUNTIME // WITH_RUNTIME
+2 -2
View File
@@ -1,6 +1,6 @@
// "Add '-Xuse-experimental=kotlin.Experimental' to module light_idea_test_case compiler arguments" "true" // "Add '-Xuse-experimental=kotlin.RequiresOptIn' to module light_idea_test_case compiler arguments" "true"
// COMPILER_ARGUMENTS: -version // COMPILER_ARGUMENTS: -version
// COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.RequiresOptIn
// DISABLE-ERRORS // DISABLE-ERRORS
// WITH_RUNTIME // WITH_RUNTIME
+1 -1
View File
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true" // "Add '@OptIn(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments // ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
+2 -2
View File
@@ -1,4 +1,4 @@
// "Add '@UseExperimental(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true" // "Add '@OptIn(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true"
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental // COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME // WITH_RUNTIME
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments // ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
@@ -9,5 +9,5 @@ annotation class AliasMarker
@AliasMarker @AliasMarker
class AliasTarget class AliasTarget
@UseExperimental(AliasMarker::class) @OptIn(AliasMarker::class)
typealias AliasMarkerUsage = AliasTarget typealias AliasMarkerUsage = AliasTarget
@@ -126,6 +126,10 @@ public final class kotlin/NumbersKt {
public static final fun rotateRight (SI)S public static final fun rotateRight (SI)S
} }
public abstract interface annotation class kotlin/OptIn : java/lang/annotation/Annotation {
public abstract fun markerClass ()[Ljava/lang/Class;
}
public abstract interface annotation class kotlin/OptionalExpectation : java/lang/annotation/Annotation { public abstract interface annotation class kotlin/OptionalExpectation : java/lang/annotation/Annotation {
} }
@@ -154,6 +158,17 @@ public abstract interface annotation class kotlin/ReplaceWith : java/lang/annota
public abstract fun imports ()[Ljava/lang/String; public abstract fun imports ()[Ljava/lang/String;
} }
public abstract interface annotation class kotlin/RequiresOptIn : java/lang/annotation/Annotation {
public abstract fun level ()Lkotlin/RequiresOptIn$Level;
}
public final class kotlin/RequiresOptIn$Level : java/lang/Enum {
public static final field ERROR Lkotlin/RequiresOptIn$Level;
public static final field WARNING Lkotlin/RequiresOptIn$Level;
public static fun valueOf (Ljava/lang/String;)Lkotlin/RequiresOptIn$Level;
public static fun values ()[Lkotlin/RequiresOptIn$Level;
}
public final class kotlin/Result : java/io/Serializable { public final class kotlin/Result : java/io/Serializable {
public static final field Companion Lkotlin/Result$Companion; public static final field Companion Lkotlin/Result$Companion;
public static final synthetic fun box-impl (Ljava/lang/Object;)Lkotlin/Result; public static final synthetic fun box-impl (Ljava/lang/Object;)Lkotlin/Result;