Support sealed class inheritors in the same file
#KT-11573 Fixed
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
sealed class A {
|
||||
class B: A() {
|
||||
class C: A()
|
||||
}
|
||||
}
|
||||
|
||||
class D: A()
|
||||
|
||||
fun test(a: A) {
|
||||
val nonExhaustive = <!NO_ELSE_IN_WHEN!>when<!> (a) {
|
||||
is A.B -> "B"
|
||||
is A.B.C -> "C"
|
||||
}
|
||||
|
||||
val exhaustive = when (a) {
|
||||
is A.B -> "B"
|
||||
is A.B.C -> "C"
|
||||
is D -> "D"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user