SLC: regression test for final modifier on enum members

^KT-57567
This commit is contained in:
Jinseong Jeon
2023-04-04 18:28:09 -07:00
committed by Ilya Kirillov
parent a3db0f14af
commit 9fe30bfc12
10 changed files with 263 additions and 0 deletions
@@ -0,0 +1,26 @@
enum class Event {
ON_CREATE, ON_START, ON_STOP, ON_DESTROY;
companion object {
@JvmStatic
fun upTo(state: State): Event? {
return when(state) {
State.ENQUEUED -> ON_CREATE
State.RUNNING -> ON_START
State.BLOCKED -> ON_STOP
else -> null
}
}
}
}
enum class State {
ENQUEUED, RUNNING, SUCCEEDED, FAILED, BLOCKED, CANCELLED;
val isFinished: Boolean
get() = this == SUCCEEDED || this == FAILED || this == CANCELLED
fun isAtLeast(state: State): Boolean {
return compareTo(state) >= 0
}
companion object {
fun done(state: State) = state.isFinished
}
}