Introduce action to add missing when branches on sealed class
Made via diagnostics NON_EXHAUSTIVE_WHEN_FOR_SEALED_CLASS with INFO severity and quick-fix So #KT-17580 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
1072495001
commit
e30b9758f4
+16
@@ -0,0 +1,16 @@
|
||||
sealed class S
|
||||
|
||||
object First : S()
|
||||
|
||||
class Derived(val s: String) : S()
|
||||
|
||||
object Last : S()
|
||||
|
||||
fun use(s: String) = s
|
||||
|
||||
fun foo(s: S) {
|
||||
<!NON_EXHAUSTIVE_WHEN_ON_SEALED_CLASS!>when<!> (s) {
|
||||
First -> {}
|
||||
is Derived -> use(<!DEBUG_INFO_SMARTCAST!>s<!>.s)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user