JET-183 Typechecker fails with enum constants
+ Tests for annotations
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user