Files
kotlin-fork/compiler/testData/codegen/box/valueClasses/secondaryConstructorWithVararg.kt
T
Alexander Udalov 23fb96378e Tests: remove duplicate LANGUAGE test directives
To help them run on the old infrastructure, which light analysis tests
are still using.
2023-06-13 17:48:23 +00:00

26 lines
590 B
Kotlin
Vendored

// WITH_STDLIB
// LANGUAGE: +ValueClasses
// TARGET_BACKEND: JVM_IR
// WORKS_WHEN_VALUE_CLASS
OPTIONAL_JVM_INLINE_ANNOTATION
value class Z(val x: Int, val y: Int) {
constructor(vararg ys: Long) : this(ys.size, -ys.size)
}
fun box(): String {
val z1 = Z(111, 222)
if (z1.x != 111) throw AssertionError()
if (z1.y != 222) throw AssertionError()
val z2 = Z()
if (z2.x != 0) throw AssertionError()
if (z2.y != 0) throw AssertionError()
val z3 = Z(2222L)
if (z3.x != 1) throw AssertionError()
if (z3.y != -1) throw AssertionError()
return "OK"
}