[IR] Add more tests for inline/value classes secondary constructors

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
This commit is contained in:
Evgeniy.Zhelenskiy
2023-04-12 00:59:14 +02:00
committed by Space Team
parent f75b72990e
commit 8c748bfea4
52 changed files with 909 additions and 31 deletions
@@ -0,0 +1,11 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
@JvmInline
value class A<!CONFLICTING_JVM_DECLARATIONS!>(val x: Int)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: UInt)<!>: this(x.toInt())
}
data class B<!CONFLICTING_JVM_DECLARATIONS!>(val x: UInt)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: Int)<!> : this(x.toUInt())
}
@@ -0,0 +1,11 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
@JvmInline
value class <!CONFLICTING_JVM_DECLARATIONS!>A(val x: Int)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: UInt)<!>: this(x.toInt())
}
data class <!CONFLICTING_JVM_DECLARATIONS!>B(val x: UInt)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: Int)<!> : this(x.toUInt())
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +ValueClasses
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
@JvmInline
value class A(val x: Int, val y: Int) {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(other: A)<!>: this(other.x, other.y)
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: UInt, y: UInt)<!>: this(x.toInt(), y.toInt())
}
data class <!CONFLICTING_JVM_DECLARATIONS!>B<!CONFLICTING_JVM_DECLARATIONS!>(val x: UInt, val y: UInt)<!><!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(other: A)<!> : this(other.x, other.y)
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: Int, y: Int)<!> : this(x.toUInt(), y.toUInt())
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +ValueClasses
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
@JvmInline
value class A(val x: Int, val y: Int) {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(other: A)<!>: this(other.x, other.y)
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: UInt, y: UInt)<!>: this(x.toInt(), y.toInt())
}
data class <!CONFLICTING_JVM_DECLARATIONS, CONFLICTING_JVM_DECLARATIONS!>B(val x: UInt, val y: UInt)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(other: A)<!> : this(other.x, other.y)
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: Int, y: Int)<!> : this(x.toUInt(), y.toUInt())
}