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) {
^
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()
^
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) {
^
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()
^
COMPILATION_ERROR
@@ -2,10 +2,10 @@
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME
// 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
// 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 '@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 '@OptIn(MyExperimentalAPI::class)'
@Experimental
@Target(AnnotationTarget.CLASS)
@@ -20,4 +20,4 @@ class Bar {
fun bar() {
Some().foo<caret>()
}
}
}
@@ -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
// WITH_RUNTIME
@@ -17,4 +17,4 @@ class Bar {
fun bar() {
Some().foo<caret>()
}
}
}
@@ -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
// WITH_RUNTIME
@@ -14,8 +14,8 @@ class Some {
}
class Bar {
@UseExperimental(MyExperimentalAPI::class)
@OptIn(MyExperimentalAPI::class)
fun bar() {
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
// WITH_RUNTIME
@@ -15,4 +15,4 @@ class Bar {
fun bar() {
foo<caret>()
}
}
}
@@ -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
// WITH_RUNTIME
@@ -11,9 +11,9 @@ annotation class MyExperimentalAPI
@MyExperimentalAPI
fun foo() {}
@UseExperimental(MyExperimentalAPI::class)
@OptIn(MyExperimentalAPI::class)
class Bar {
fun bar() {
foo()
}
}
}
+3 -3
View File
@@ -3,10 +3,10 @@
// WITH_RUNTIME
// ACTION: Add '@MyExperimentalAPI' annotation to 'bar'
// 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: 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
annotation class MyExperimentalAPI
@@ -22,4 +22,4 @@ class Outer {
}
}
}
}
}
+3 -3
View File
@@ -2,8 +2,8 @@
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
// WITH_RUNTIME
// ACTION: Add '@MyExperimentalAPI' annotation to 'foo'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'foo'
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to containing class 'Derived'
// ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to 'foo'
// ACTION: Add '@OptIn(MyExperimentalAPI::class)' annotation to containing class 'Derived'
// 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'
@@ -18,4 +18,4 @@ open class Base {
class Derived : Base() {
override fun foo<caret>() {}
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
// "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_AFTER: -version -Xuse-experimental=kotlin.Experimental
// COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.RequiresOptIn
// DISABLE-ERRORS
// WITH_RUNTIME
@Experimental<caret>
annotation class MyExperimentalAPI
annotation class MyExperimentalAPI
+3 -3
View File
@@ -1,8 +1,8 @@
// "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_AFTER: -version -Xuse-experimental=kotlin.Experimental
// COMPILER_ARGUMENTS_AFTER: -version -Xuse-experimental=kotlin.RequiresOptIn
// DISABLE-ERRORS
// WITH_RUNTIME
@Experimental
annotation class MyExperimentalAPI
annotation class MyExperimentalAPI
+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
// WITH_RUNTIME
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
@@ -9,4 +9,4 @@ annotation class AliasMarker
@AliasMarker
class AliasTarget
typealias AliasMarkerUsage = <caret>AliasTarget
typealias AliasMarkerUsage = <caret>AliasTarget
+3 -3
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
// WITH_RUNTIME
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
@@ -9,5 +9,5 @@ annotation class AliasMarker
@AliasMarker
class AliasTarget
@UseExperimental(AliasMarker::class)
typealias AliasMarkerUsage = AliasTarget
@OptIn(AliasMarker::class)
typealias AliasMarkerUsage = AliasTarget
@@ -126,6 +126,10 @@ public final class kotlin/NumbersKt {
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 {
}
@@ -154,6 +158,17 @@ public abstract interface annotation class kotlin/ReplaceWith : java/lang/annota
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 static final field Companion Lkotlin/Result$Companion;
public static final synthetic fun box-impl (Ljava/lang/Object;)Lkotlin/Result;