[IR] Correct work of the new MFVC lowering classes

#KT-1179
This commit is contained in:
Evgeniy.Zhelenskiy
2022-10-01 03:56:29 +02:00
committed by teamcity
parent 8ba20bee5b
commit 6f94af80ab
36 changed files with 4411 additions and 2968 deletions
@@ -2,6 +2,7 @@
// TARGET_BACKEND: JVM_IR
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
// CHECK_BYTECODE_LISTING
@JvmInline
value class IC(val x: UInt)
@@ -18,4 +19,12 @@ value class GreaterMFVC(val x: SimpleMFVC, val y: IC, val z: SimpleMFVC)
fun gmfvc(ic: IC, x: GreaterMFVC, ic1: UInt) = smfvc(ic, x.x, 0U) + ic(x.y) + smfvc(IC(0U), x.z, ic1)
fun box() = "OK" // todo real test
fun box(): String {
val o1 = IC(2U)
require(ic(o1) == 2U)
val o2 = SimpleMFVC(1U, o1, "3")
require(smfvc(IC(4U), o2, 5U) == 12U)
val o3 = GreaterMFVC(o2, IC(6U), SimpleMFVC(7U, IC(8U), "9"))
require(gmfvc(IC(10U), o3, 11U) == 45U)
return "OK"
}