Files
kotlin-fork/compiler/testData/codegen/box/valueClasses/secondaryConstructorExpectActual.kt
T
Evgeniy.Zhelenskiy 8c748bfea4 [IR] Add more tests for inline/value classes secondary constructors
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2023-04-17 12:10:14 +00:00

23 lines
606 B
Kotlin
Vendored

// LANGUAGE: +MultiPlatformProjects, +ValueClasses
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: expect.kt
expect value class ExpectValue(val x: String, val y: String) {
constructor(x: Int, y: Int)
}
// MODULE: main()()(common)
// TARGET_PLATFORM: JVM
// FILE: actual.kt
@JvmInline
actual value class ExpectValue actual constructor(actual val x: String, actual val y: String) {
actual constructor(x: Int, y: Int) : this(if (x == 42) "O" else "Not OK: $x\n", if (y == -42) "K" else "Not OK: $y")
}
fun box() = ExpectValue(42, -42).run { x + y }