Files
kotlin/compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt
Alexander Udalov a8bebeb48d Load annotations of const properties from multifile classes
Rework backing field generation logic in PropertyCodegen to switch the
ClassBuilder instance for a multifile part to that of the corresponding facade
class. This became needed because multifile parts, and their metadata, are
generated _before_ the multifile facade class and otherwise we would never
record that there's a synthetic '$annotations' method for a const val and would
not write that to the protobuf message for the property.

See also bad83200

 #KT-10892 Fixed
2016-03-28 21:11:14 +03:00

26 lines
372 B
Kotlin
Vendored

// WITH_REFLECT
// FILE: 1.kt
import a.OK
fun box(): String {
val okRef = ::OK
val annotations = okRef.annotations
if (annotations.size != 1) {
return "Failed, annotations: $annotations"
}
return okRef.get()
}
// FILE: 2.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
annotation class A
@A
const val OK: String = "OK"