diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt index e9953f50c81..ea495aaa55d 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt @@ -462,7 +462,7 @@ class IrBuiltInsOverFir( } createFunction( - "CHECK_NOT_NULL", + BuiltInOperatorNames.CHECK_NOT_NULL, IrSimpleTypeImpl(typeParameter.symbol, SimpleTypeNullability.DEFINITELY_NOT_NULL, emptyList(), emptyList()), arrayOf("" to IrSimpleTypeImpl(typeParameter.symbol, hasQuestionMark = true, emptyList(), emptyList())), typeParameters = listOf(typeParameter), diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/proxy/Proxy.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/proxy/Proxy.kt index 5cfd3795c33..ad16aa4595c 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/proxy/Proxy.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/proxy/Proxy.kt @@ -5,6 +5,8 @@ package org.jetbrains.kotlin.ir.interpreter.proxy +import org.jetbrains.kotlin.ir.BuiltInOperatorNames +import org.jetbrains.kotlin.ir.IrBuiltIns import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.interpreter.CallInterceptor import org.jetbrains.kotlin.ir.interpreter.fqName @@ -15,6 +17,7 @@ import org.jetbrains.kotlin.ir.interpreter.state.* import org.jetbrains.kotlin.ir.interpreter.state.reflection.ReflectionState import org.jetbrains.kotlin.ir.types.isArray import org.jetbrains.kotlin.ir.types.isFloat +import org.jetbrains.kotlin.name.Name import java.lang.invoke.MethodType internal interface Proxy { @@ -43,12 +46,15 @@ internal fun State.wrap(callInterceptor: CallInterceptor, remainArraysAsIs: Bool } } +private val eqeqName = IrBuiltIns.KOTLIN_INTERNAL_IR_FQN.child(Name.identifier(BuiltInOperatorNames.EQEQ)).asString() +private val checkNotNullName = IrBuiltIns.KOTLIN_INTERNAL_IR_FQN.child(Name.identifier(BuiltInOperatorNames.CHECK_NOT_NULL)).asString() + /** * Prepare state object to be passed in outer world */ internal fun List.wrap(callInterceptor: CallInterceptor, irFunction: IrFunction, methodType: MethodType? = null): List { val name = irFunction.fqName - if (name == "kotlin.internal.ir.EQEQ" && this.any { it is Common }) { + if (name == eqeqName && this.any { it is Common }) { // in case of custom `equals` it is important not to lose information obout type // so all states remain as is, only common will be converted to Proxy return mapIndexed { index, state -> @@ -58,7 +64,7 @@ internal fun List.wrap(callInterceptor: CallInterceptor, irFunction: IrFu } return this.mapIndexed { index, state -> // don't get arrays from Primitive in case of "set" and "Pair."; information about type will be lost - val unwrapArrays = (name == "kotlin.Array.set" && index != 0) || name == "kotlin.Pair." || name == "kotlin.internal.ir.CHECK_NOT_NULL" + val unwrapArrays = (name == "kotlin.Array.set" && index != 0) || name == "kotlin.Pair." || name == checkNotNullName state.wrap(callInterceptor, unwrapArrays, methodType?.parameterType(index)) } } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/descriptors/IrBuiltInsOverDescriptors.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/descriptors/IrBuiltInsOverDescriptors.kt index 478a859d0e8..7926a1fe17a 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/descriptors/IrBuiltInsOverDescriptors.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/descriptors/IrBuiltInsOverDescriptors.kt @@ -148,7 +148,7 @@ class IrBuiltInsOverDescriptors( } private fun defineCheckNotNullOperator(): IrSimpleFunctionSymbol { - val name = Name.identifier("CHECK_NOT_NULL") + val name = Name.identifier(BuiltInOperatorNames.CHECK_NOT_NULL) val typeParameterDescriptor: TypeParameterDescriptor val valueParameterDescriptor: ValueParameterDescriptor diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrBuiltIns.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrBuiltIns.kt index 2a144f3f0af..99bc4e05702 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrBuiltIns.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrBuiltIns.kt @@ -201,4 +201,5 @@ object BuiltInOperatorNames { const val ILLEGAL_ARGUMENT_EXCEPTION = "illegalArgumentException" const val ANDAND = "ANDAND" const val OROR = "OROR" + const val CHECK_NOT_NULL = "CHECK_NOT_NULL" }