mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
17 lines
258 B
Kotlin
Vendored
17 lines
258 B
Kotlin
Vendored
sealed class A {
|
|
class B : A()
|
|
|
|
class C : A()
|
|
}
|
|
|
|
inline fun foo(): A = A.B()
|
|
|
|
fun box(): String {
|
|
val a: A = foo()
|
|
val b: Boolean
|
|
when (a) {
|
|
is A.B -> b = true
|
|
is A.C -> b = false
|
|
}
|
|
return if (b) "OK" else "FAIL"
|
|
} |