mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 00:21:35 +00:00
These tests check behavior of an old language version on purpose: the original bug KT-24708 has been fixed by introducing an error here in 1.4.
31 lines
445 B
Kotlin
Vendored
31 lines
445 B
Kotlin
Vendored
// !LANGUAGE: -ProhibitComparisonOfIncompatibleEnums
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
|
|
enum class A {
|
|
O, K
|
|
}
|
|
|
|
enum class B {
|
|
O, K
|
|
}
|
|
|
|
fun box(): String {
|
|
val a = A.O
|
|
val r1 = when (a) {
|
|
A.O -> "O"
|
|
A.K -> "K"
|
|
B.O -> "fail 1"
|
|
B.K -> "fail 2"
|
|
}
|
|
|
|
val b = B.K
|
|
val r2 = when (b) {
|
|
A.O -> "fail 3"
|
|
A.K -> "fail 4"
|
|
B.O -> "O"
|
|
B.K -> "K"
|
|
}
|
|
|
|
return r1 + r2
|
|
}
|