Add tests for inline class variables captured in closure

This commit is contained in:
Dmitry Petrov
2018-08-24 17:29:47 +03:00
parent 7e49005bab
commit d9593c7a34
7 changed files with 107 additions and 0 deletions
@@ -0,0 +1,29 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Z(val int: Int)
inline class L(val long: Long)
inline class Str(val string: String)
inline class Obj(val obj: Any)
fun box(): String {
var xz = Z(0)
var xl = L(0L)
var xs = Str("")
var xo = Obj("")
val fn = {
xz = Z(42)
xl = L(1234L)
xs = Str("abc")
xo = Obj("def")
}
fn()
if (xz.int != 42) throw AssertionError()
if (xl.long != 1234L) throw AssertionError()
if (xs.string != "abc") throw AssertionError()
if (xo.obj != "def") throw AssertionError()
return "OK"
}