K2: link via signatures if -Xlink-via-signatures is set

Related to KT-53505
This commit is contained in:
Mikhail Glukhikh
2022-09-12 10:26:32 +02:00
committed by Space
parent a0fa2cc275
commit 036f9affd8
8 changed files with 74 additions and 13 deletions
+26
View File
@@ -0,0 +1,26 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
// LINK_VIA_SIGNATURES
class Class
interface Interface
sealed class Sealed<T>
enum class E { ENTRY }
fun function(s: String): Array<Int> {
fun Boolean.local() {}
return arrayOf(s.length)
}
typealias S = String
var property: S? = "OK"
fun box(): String {
val c = Class()
val o = object : Interface {}
if (property != "OK") return property!!
if (E.ENTRY.ordinal != 0) return E.ENTRY.ordinal.toString()
val result = function("AlphaBeta")
if (result.size != 1) return result.size.toString()
if (result[0] != 9) return result[0].toString()
return "OK"
}