mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
35 lines
647 B
Kotlin
Vendored
35 lines
647 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
|
|
inline class Inner(val x: Int)
|
|
inline class A(val x: Inner)
|
|
|
|
var i = 0
|
|
|
|
fun set1(): A {
|
|
i = 1
|
|
return A(Inner(0))
|
|
}
|
|
|
|
fun test1(n: Int): A {
|
|
if (i != 1)
|
|
throw IllegalStateException("Fail $n")
|
|
i = 0
|
|
return A(Inner(0))
|
|
}
|
|
|
|
fun set1Boxed(): Any? = set1()
|
|
fun test1Boxed(n: Int): Any? = test1(n)
|
|
|
|
fun box(): String {
|
|
try {
|
|
set1() == test1(1)
|
|
set1Boxed() == test1(2)
|
|
set1() == test1Boxed(3)
|
|
set1Boxed() == test1Boxed(4)
|
|
} catch (e: IllegalStateException) {
|
|
return e.message ?: "Fail no message"
|
|
}
|
|
return "OK"
|
|
}
|