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.
27 lines
688 B
Kotlin
Vendored
27 lines
688 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
|
@kotlin.jvm.JvmInline
|
|
value class Result<T>(val a: Any?)
|
|
|
|
fun box(): String {
|
|
val a = Result<Int>(1) // valueOf
|
|
val b = Result<String>("sample")
|
|
val c = Result<Result<Int>>(a)
|
|
val d = Result<Result<Int>>(Result<Int>(1)) // valueOf
|
|
|
|
if (a.a !is Int) throw AssertionError()
|
|
|
|
if (b.a !is String) throw AssertionError()
|
|
|
|
if (c.a !is Result<*>) throw AssertionError()
|
|
val ca = c.a as Result<*>
|
|
if (ca.a !is Int) throw AssertionError()
|
|
|
|
if (d.a !is Result<*>) throw AssertionError()
|
|
val da = d.a as Result<*>
|
|
if (da.a !is Int) throw AssertionError()
|
|
|
|
return "OK"
|
|
}
|