Files
Kirill Rakhman cf2ef443f4 [FIR] Introduce a feature flag for context-sensitive enum resolution
The feature was previously enabled unconditionally in K2 which
triggered a bug when an enum has an entry with the same name as itself.

#KT-58897 Fixed
#KT-52774
2023-05-30 11:59:56 +00:00

34 lines
594 B
Kotlin
Vendored

// LANGUAGE: +ContextSensitiveEnumResolutionInWhen
enum class Outer {
FIRST, SECOND;
}
enum class Inner {
SECOND, THIRD;
}
fun foo(o: Outer, i: Inner): Int {
return when (o) {
FIRST -> 1
SECOND -> when (i) {
SECOND -> 2
THIRD -> 3
}
}
}
fun bar(o: Outer, i: Inner): Int {
return when (o) {
FIRST -> 1
SECOND -> {
fun baz(): Int {
return when (i) {
SECOND -> 2
THIRD -> 3
}
}
baz()
}
}
}