Files
kotlin-fork/compiler/testData/codegen/box/valueClasses/nestedLoweringStart.kt
T
Evgeniy.Zhelenskiy 2535a87f85 [IR] Change value classes lowering dispatching strategy
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2023-05-12 18:36:49 +00:00

36 lines
507 B
Kotlin
Vendored

// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
// LANGUAGE: +ValueClasses
// CHECK_BYTECODE_LISTING
// FIR_IDENTICAL
@JvmInline
value class Point(val x: Double, val y: Double)
class A {
fun b(p: Point) {
res = p
}
}
var res: Any? = null
fun toA(out: A): A {
fun g(p: List<Point>) {
out.b(p.first())
}
g(listOf(Point(1.0, 2.0)))
return out
}
fun box(): String {
val a = A()
toA(a)
require(res.toString() == Point(1.0, 2.0).toString())
return "OK"
}