FIR: implement OPT_IN_MARKER_ON_WRONG_TARGET

This commit is contained in:
Mikhail Glukhikh
2021-09-02 18:16:22 +03:00
committed by TeamCityServer
parent 8bb16d8e7a
commit 3045a5e920
13 changed files with 153 additions and 47 deletions
@@ -47,12 +47,12 @@ annotation class E5
annotation class E6
var some: Int
@E4
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@E4<!>
get() = 42
@E5
set(value) {}
@get:E4
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@get:E4<!>
val another: Int = 42
class My {
@@ -75,21 +75,21 @@ class Derived : Base {
@E6
override val bar: Int = 42
@set:E6 @setparam:E6
@set:E6 <!OPT_IN_MARKER_ON_WRONG_TARGET!>@setparam:E6<!>
override var baz: Int = 13
@E6
override fun foo() {}
override fun @receiver:E6 String.withReceiver() {}
override fun <!OPT_IN_MARKER_ON_WRONG_TARGET!>@receiver:E6<!> String.withReceiver() {}
}
abstract class Another(@param:E6 val x: String) : Base {
@delegate:E6
abstract class Another(<!OPT_IN_MARKER_ON_WRONG_TARGET!>@param:E6<!> val x: String) : Base {
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@delegate:E6<!>
override val bar: Int by lazy { 42 }
fun baz(@E6 param: Int) {
@E6 val x = param
fun baz(<!OPT_IN_MARKER_ON_WRONG_TARGET!>@E6<!> param: Int) {
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@E6<!> val x = param
}
}
@@ -1,25 +0,0 @@
// !OPT_IN: kotlin.RequiresOptIn
@RequiresOptIn
annotation class SomeOptInMarker
@RequiresOptIn
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.LOCAL_VARIABLE)
annotation class OtherOptInMarker
class IntWrapper(
@SomeOptInMarker
@OtherOptInMarker
val value: Int
) {
val isEven: Boolean
@SomeOptInMarker
@OtherOptInMarker
get() = (value % 2) == 0
}
fun foo() {
@SomeOptInMarker
@OtherOptInMarker
val value = 2
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !OPT_IN: kotlin.RequiresOptIn
@RequiresOptIn