Experimental fixes: introduce "add annotation" (KT-22760)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to 'bar'" "true"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Experimental
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
|
||||
class Bar {
|
||||
fun bar() {
|
||||
foo<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to 'bar'" "true"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Experimental
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
|
||||
class Bar {
|
||||
@MyExperimentalAPI
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to containing class 'Bar'" "true"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Experimental
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
|
||||
class Bar {
|
||||
fun bar() {
|
||||
foo<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to containing class 'Bar'" "true"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Experimental
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
|
||||
@MyExperimentalAPI
|
||||
class Bar {
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to 'bar'" "false"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Bar'
|
||||
// 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)'
|
||||
|
||||
@Experimental
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
class Some {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
fun bar() {
|
||||
Some().foo<caret>()
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Add '@MyExperimentalAPI' annotation to containing class 'Derived'" "false"
|
||||
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Add '@MyExperimentalAPI' annotation to 'foo'
|
||||
// ERROR: This declaration overrides experimental member of supertype 'Base' and must be annotated with '@MyExperimentalAPI'
|
||||
|
||||
@Experimental
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
open class Base {
|
||||
@MyExperimentalAPI
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
override fun foo<caret>() {}
|
||||
}
|
||||
Reference in New Issue
Block a user