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
@@ -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