Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/experimental/wrongTargetsWithoutExplicitTarget.kt
T
2021-09-29 19:39:20 +03:00

26 lines
771 B
Kotlin
Vendored

// FIR_IDENTICAL
// !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(
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@SomeOptInMarker<!>
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@OtherOptInMarker<!>
val value: Int
) {
val isEven: Boolean
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@SomeOptInMarker<!>
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@OtherOptInMarker<!>
get() = (value % 2) == 0
}
fun foo() {
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@SomeOptInMarker<!>
<!OPT_IN_MARKER_ON_WRONG_TARGET!>@OtherOptInMarker<!>
val value = 2
}