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
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
annotation class Second
|
||||
|
||||
class CustomDelegate {
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@property:Ann<!>
|
||||
class SomeClass {
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@property:Ann<!>
|
||||
constructor(s: String)
|
||||
|
||||
@property:Ann
|
||||
protected val p1: String = ""
|
||||
|
||||
@property:[Ann Second]
|
||||
protected val p2: String = ""
|
||||
|
||||
@property:Ann
|
||||
protected var p3: String = ""
|
||||
|
||||
@property:Ann
|
||||
protected val p4: String by CustomDelegate()
|
||||
|
||||
@property:Ann
|
||||
var propertyWithCustomSetter: Int
|
||||
get() = 5
|
||||
set(v) {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@property:Ann<!>
|
||||
fun anotherFun() {
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@property:Ann<!>
|
||||
val localVariable = 5
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
|
||||
Reference in New Issue
Block a user