Do not optimize == for KClasses in redundant boxing elimination
For primitive wrappers such as java.lang.Integer, jlc = java.lang.Integer.class jlt = java.lang.Integer.TYPE !(ljc.equals(ljt)) However, in Kotlin corresponding KClass instances are equal. #KT-17748 Fixed Target versions 1.1.50 #KT-17879 Fixed Target versions 1.1.50
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
fun box(): String {
|
||||
42.doSwitchInt()
|
||||
"".doSwitchString()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
inline fun <reified E> E.doSwitchInt(): String = when (E::class) {
|
||||
Int::class -> "success!"
|
||||
else -> throw AssertionError()
|
||||
}
|
||||
|
||||
inline fun <reified E> E.doSwitchString(): String = when(E::class) {
|
||||
String::class -> "success!"
|
||||
else -> throw AssertionError()
|
||||
}
|
||||
Reference in New Issue
Block a user