diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/CallInfo.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/CallInfo.kt index b221f15e262..ac432e4b75b 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/CallInfo.kt +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/CallInfo.kt @@ -16,6 +16,8 @@ package org.jetbrains.kotlin.js.translate.callTranslator +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.contracts.parsing.isEqualsDescriptor import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor @@ -137,8 +139,12 @@ private fun TranslationContext.createCallInfo( var dispatchReceiver = getDispatchReceiver() var dispatchReceiverType = resolvedCall.smartCastDispatchReceiverType ?: resolvedCall.dispatchReceiver?.type - if (dispatchReceiverType != null && (resolvedCall.resultingDescriptor as? FunctionDescriptor)?.kind?.isReal == false) { - dispatchReceiverType = TranslationUtils.getDispatchReceiverTypeForCoercion(resolvedCall.resultingDescriptor) + if (dispatchReceiverType != null) { + if ((resolvedCall.resultingDescriptor as? FunctionDescriptor)?.kind?.isReal == false) { + dispatchReceiverType = TranslationUtils.getDispatchReceiverTypeForCoercion(resolvedCall.resultingDescriptor) + } else if (KotlinBuiltIns.isChar(dispatchReceiverType) && resolvedCall.resultingDescriptor.isEqualsDescriptor()) { + dispatchReceiverType = resolvedCall.resultingDescriptor.overriddenDescriptors.single().dispatchReceiverParameter!!.type + } } var extensionReceiver = getExtensionReceiver() var notNullConditional: JsConditional? = null