Fix condition of generating equals-impl0 call
This methods should not be called when instances of different inline classes are being compared ^KT-57242: Fixed
This commit is contained in:
committed by
teamcity
parent
948714e7e5
commit
8039e30bbd
+4
-4
@@ -283,11 +283,11 @@ internal class JvmInlineClassLowering(
|
||||
if (left.type.isUnsigned() && right.type.isUnsigned() && rightIsUnboxed)
|
||||
return irEquals(left.coerceToUnboxed(), right.coerceToUnboxed())
|
||||
|
||||
val klass = left.type.classOrNull!!.owner
|
||||
val equalsMethod = if (rightIsUnboxed) {
|
||||
this@JvmInlineClassLowering.context.inlineClassReplacements.getSpecializedEqualsMethod(klass, context.irBuiltIns)
|
||||
val leftOperandClass = left.type.classOrNull!!.owner
|
||||
val equalsMethod = if (rightIsUnboxed && leftOperandClass == right.type.classOrNull!!.owner) {
|
||||
this@JvmInlineClassLowering.context.inlineClassReplacements.getSpecializedEqualsMethod(leftOperandClass, context.irBuiltIns)
|
||||
} else {
|
||||
val equals = klass.functions.single { it.name.asString() == "equals" && it.overriddenSymbols.isNotEmpty() }
|
||||
val equals = leftOperandClass.functions.single { it.name.asString() == "equals" && it.overriddenSymbols.isNotEmpty() }
|
||||
this@JvmInlineClassLowering.context.inlineClassReplacements.getReplacementFunction(equals)!!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user