FIR: implement resolve of unqualified enum references in when

See KT-16768
This commit is contained in:
Mikhail Glukhikh
2022-02-17 14:13:14 +03:00
committed by teamcity
parent f35b4b7515
commit 981f8b1871
28 changed files with 820 additions and 34 deletions
+32
View File
@@ -0,0 +1,32 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM_IR
// WITH_STDLIB
enum class Rainbow {
RED,
ORANGE,
YELLOW,
GREEN,
CYAN,
BLUE,
VIOLET
}
fun sym(r: Rainbow) = when (r) {
RED -> 'r'
ORANGE -> 'o'
YELLOW -> 'y'
GREEN -> 'g'
CYAN -> 'c'
BLUE -> 'b'
VIOLET -> 'v'
}
fun box(): String {
val s = buildString {
for (value in Rainbow.values()) {
append(sym(value))
}
}
return if (s == "roygcbv") "OK" else s
}