KT-10295: long enum (sealed) special case

This commit is contained in:
Mikhail Glukhikh
2016-01-11 17:21:03 +03:00
parent c085eb650f
commit 936fee0afa
2 changed files with 13 additions and 2 deletions
+8
View File
@@ -28,6 +28,14 @@ fun whenOnEnum(c: Color) {
}
}
enum class EnumInt {
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
}
fun whenOnLongEnum(i: EnumInt) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', ... branches or 'else' branch instead">when</error> (i) {
EnumInt.A7 -> 7
}
sealed class Variant {
object Singleton : Variant()