Psi2Ir: Mark accessors with no bodies as default accessors.
They are currently marked as defined even when they get a default implementation. That makes it hard to figure out if the accessor should be removed when introducing a backing field in the JVM_IR backend.
This commit is contained in:
committed by
Alexander Udalov
parent
fda37eaaae
commit
6c7a904663
@@ -0,0 +1,31 @@
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// Please make sure that this test is consistent with the diagnostic test "annotationsTargetingLateinitAccessor.kt"
|
||||
|
||||
import kotlin.reflect.KAnnotatedElement
|
||||
|
||||
annotation class Ann
|
||||
|
||||
fun check(element: KAnnotatedElement, annotationExists: Boolean) {
|
||||
require(element.annotations.isNotEmpty() == annotationExists) { "Fail: $element" }
|
||||
}
|
||||
|
||||
class LateinitProperties {
|
||||
@get:Ann
|
||||
lateinit var x0: String
|
||||
|
||||
@get:Ann
|
||||
private lateinit var x1: String
|
||||
|
||||
fun test() {
|
||||
check(::x0.getter, annotationExists = true)
|
||||
check(::x1.getter, annotationExists = false)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
LateinitProperties().test()
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user