1/2 Refactoring: split GetterAnnotations & PropertyAnnotations tests for K1 and K2
These tests won't be FIR_IDENTICAL after the next commit. That's why I split them prematurely. This allows me to have a nicer diff in `2/2` commit. In scope of KT-15470 Review: https://jetbrains.team/p/kt/reviews/9250
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
|
||||
class CustomDelegate {
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@get:Ann<!>
|
||||
class SomeClass {
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@get:Ann<!>
|
||||
constructor()
|
||||
|
||||
@get:Ann
|
||||
protected val simpleProperty: String = "text"
|
||||
|
||||
@get:Ann
|
||||
protected var mutableProperty: String = "text"
|
||||
|
||||
@get:[Ann]
|
||||
protected val simplePropertyWithAnnotationList: String = "text"
|
||||
|
||||
@get:Ann
|
||||
protected val delegatedProperty: String by CustomDelegate()
|
||||
|
||||
@get:Ann
|
||||
val propertyWithCustomGetter: Int
|
||||
get() = 5
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@get:Ann<!>
|
||||
fun annotationOnFunction(a: Int) = a + 5
|
||||
|
||||
fun anotherFun() {
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@get:Ann<!>
|
||||
val localVariable = 5
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user