Fix equals

This commit is contained in:
Mikhael Bogdanov
2017-12-04 16:31:27 +01:00
parent d7f0695a51
commit 9a1f484771
@@ -29,8 +29,11 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class Equals(val operator: IElementType) : IntrinsicMethod() { class Equals(val operator: IElementType) : IntrinsicMethod() {
override fun toCallable(expression: IrMemberAccessExpression, signature: JvmMethodSignature, context: JvmBackendContext): IrIntrinsicFunction { override fun toCallable(expression: IrMemberAccessExpression, signature: JvmMethodSignature, context: JvmBackendContext): IrIntrinsicFunction {
var leftType = context.state.typeMapper.mapType(expression.getValueArgument(0)!!.type) val receiverAndArgs = expression.receiverAndArgs().apply {
var rightType = context.state.typeMapper.mapType(expression.getValueArgument(1)!!.type) assert(size == 2) { "Equals expects 2 arguments, but ${joinToString()}" }
}
var leftType = context.state.typeMapper.mapType(receiverAndArgs.first().type)
var rightType = context.state.typeMapper.mapType(receiverAndArgs.last().type)
if (isPrimitive(leftType) != isPrimitive(rightType)) { if (isPrimitive(leftType) != isPrimitive(rightType)) {
leftType = boxType(leftType) leftType = boxType(leftType)