Use isJvmInterface in JVM back-end instead of isInterface

To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
This commit is contained in:
Alexander Udalov
2018-01-23 18:55:13 +01:00
parent a46a2b9b1c
commit 543db380d2
12 changed files with 92 additions and 17 deletions
@@ -1,10 +1,11 @@
// !LANGUAGE: +NestedClassesInAnnotations
// WITH_RUNTIME
import kotlin.test.*
interface Test {
companion object {
val x = "OK"
val x = "O"
val y1 = Test.x
@@ -34,4 +35,36 @@ interface Test {
}
}
fun box() = Test.x
annotation class Anno {
companion object {
val x = "K"
val y1 = Anno.x
val y2 = 42.let { x }
val y3: String
init {
fun localFun() = x
y3 = localFun()
}
fun method() = x
val y4 = method()
val anonObject = object {
override fun toString() = x
}
val y5 = anonObject.toString()
init {
assertEquals(x, y1)
assertEquals(x, y2)
assertEquals(x, y3)
assertEquals(x, y4)
assertEquals(x, y5)
}
}
}
fun box() = Test.x + Anno.x