mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
20 lines
277 B
Kotlin
Vendored
20 lines
277 B
Kotlin
Vendored
sealed class A {
|
|
object B : A()
|
|
|
|
class C : A()
|
|
}
|
|
|
|
fun box(): String {
|
|
val a: A = A.C()
|
|
val b: Boolean
|
|
when (a) {
|
|
A.B -> b = true
|
|
is A.C -> b = false
|
|
}
|
|
return if (!b) "OK" else "FAIL"
|
|
}
|
|
|
|
// 0 TABLESWITCH
|
|
// 0 LOOKUPSWITCH
|
|
// 1 ATHROW
|