JET-183 Typechecker fails with enum constants

+
Tests for annotations
This commit is contained in:
Andrey Breslav
2011-07-14 19:04:07 +04:00
parent 80ab7a6ca6
commit 117cead179
8 changed files with 371 additions and 295 deletions
@@ -0,0 +1,21 @@
enum class ProtocolState {
WAITING {
override fun signal() = ProtocolState.TALKING
}
TALKING {
override fun signal() = ProtocolState.WAITING
}
abstract fun signal() : ProtocolState
}
fun box(): String {
val x: ProtocolState = ProtocolState.WAITING
x = x.signal()
if (x != ProtocolState.TALKING) return "fail 1"
x = x.signal()
if (x != ProtocolState.WAITING) return "fail 2"
return "OK"
}