Build fix: nullable exhaustiveness checker is now only a part of other exhaustiveness checkers

This commit is contained in:
Mikhail Glukhikh
2016-01-12 15:43:48 +03:00
parent d928ac744e
commit 0bcae4e0c0
2 changed files with 20 additions and 9 deletions
+10
View File
@@ -6,6 +6,11 @@ fun nonExhaustiveBoolean(b: Boolean) = <error descr="[NO_ELSE_IN_WHEN] when expr
false -> 0
}
fun nonExhaustiveNullableBoolean(b: Boolean?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'null' branch or 'else' branch instead">when</error>(b) {
false -> 0
true -> 1
}
enum class Color {
RED,
GREEN,
@@ -48,6 +53,11 @@ fun nonExhaustiveSealed(v: Variant) = <error descr="[NO_ELSE_IN_WHEN] when expre
Variant.Singleton -> false
}
fun nonExhaustiveNullableSealed(v: Variant?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'Another', 'null' branches or 'else' branch instead">when</error>(v) {
Variant.Singleton -> false
is Variant.Something -> true
}
sealed class Empty
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}