c7435ba760
We are going to deprecate `WITH_RUNTIME` directive. The main reason behind this change is that `WITH_STDLIB` directive better describes its meaning, specifically it will add kotlin stdlib to test's classpath.
34 lines
837 B
Kotlin
Vendored
34 lines
837 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
|
@kotlin.jvm.JvmInline
|
|
value class Z(val int: Int)
|
|
|
|
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
|
@kotlin.jvm.JvmInline
|
|
value class Str(val string: String)
|
|
|
|
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
|
@kotlin.jvm.JvmInline
|
|
value class NStr(val string: String?)
|
|
|
|
fun fooZ(x: Z) = x
|
|
|
|
fun fooStr(x: Str) = x
|
|
|
|
fun fooNStr(x: NStr) = x
|
|
|
|
|
|
fun box(): String {
|
|
val fnZ = ::fooZ
|
|
if (fnZ.invoke(Z(42)).int != 42) throw AssertionError()
|
|
|
|
val fnStr = ::fooStr
|
|
if (fnStr.invoke(Str("str")).string != "str") throw AssertionError()
|
|
|
|
val fnNStr = ::fooNStr
|
|
if (fnNStr.invoke(NStr(null)).string != null) throw AssertionError()
|
|
if (fnNStr.invoke(NStr("nstr")).string != "nstr") throw AssertionError()
|
|
|
|
return "OK"
|
|
} |