Files
kotlin-fork/compiler/testData/codegen/box/jvmField/kt47739.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
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.
2021-11-17 15:26:38 +03:00

33 lines
645 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_STDLIB
// MODULE: lib
// FILE: Value.kt
package vv
sealed class Value<T>(@JvmField val value: T) {
class StringValue(value: String) : Value<String>(value)
class BooleanValue(value: Boolean): Value<Boolean>(value)
}
// MODULE: main(lib)
// FILE: kt47739.kt
import kotlin.test.*
import vv.*
fun test(v: Value<*>) {
when (v) {
is Value.StringValue ->
assertEquals("a string", v.value)
is Value.BooleanValue ->
assertEquals(true, v.value)
}
}
fun box(): String {
test(Value.StringValue("a string"))
test(Value.BooleanValue(true))
return "OK"
}