mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 00:21:28 +00:00
KT-18731 Use reference equality to compare enums
Fix of https://youtrack.jetbrains.com/issue/KT-18731
This commit is contained in:
committed by
Dmitry Petrov
parent
bc54c95bc3
commit
a2a3043607
16
compiler/testData/codegen/bytecodeText/enum/kt18731.kt
vendored
Normal file
16
compiler/testData/codegen/bytecodeText/enum/kt18731.kt
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
enum class Bar {
|
||||
ONE,
|
||||
TWO
|
||||
}
|
||||
|
||||
fun isOne(i: Bar) = i == Bar.ONE
|
||||
|
||||
fun box(): String {
|
||||
return when (isOne(Bar.ONE) && !isOne(Bar.TWO)) {
|
||||
true -> "OK"
|
||||
else -> "Failure"
|
||||
}
|
||||
}
|
||||
|
||||
// 1 IF_ACMPNE
|
||||
// 0 INVOKESTATIC kotlin/jvm/internal/Intrinsics.areEqual \(Ljava/lang/Object;Ljava/lang/Object;\)Z
|
||||
Reference in New Issue
Block a user