Implement IrType.equals/hashCode via isEqualTo/toHashCode
This commit is contained in:
+1
-2
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.IrTypeProjection
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.ir.types.isEqualTo
|
||||
import org.jetbrains.kotlin.ir.util.isInlined
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
@@ -546,7 +545,7 @@ class CallableReferenceLowering(val context: JsIrBackendContext) : FileLoweringP
|
||||
val value = JsIrBuilder.buildGetValue(unboundParamSymbols[i])
|
||||
val parameter = callTarget.valueParameters[j]
|
||||
val argument =
|
||||
if (parameter.varargElementType?.let { closureParam.type.isEqualTo(it) } == true) {
|
||||
if (parameter.varargElementType == closureParam.type) {
|
||||
// fun foo(x: X, vararg y: Y): Z
|
||||
// val r: (X, Y) -> Z = ::foo
|
||||
val tailValues = unboundParamSymbols.drop(i)
|
||||
|
||||
+2
-16
@@ -5,12 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.backend.js.lower.calls
|
||||
|
||||
import org.jetbrains.kotlin.ir.util.irCall
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.irCall
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
@@ -58,21 +58,7 @@ internal fun MemberToTransformer.add(type: IrType, name: Name, v: (IrCall) -> Ir
|
||||
put(SimpleMemberKey(type, name), v)
|
||||
}
|
||||
|
||||
internal class SimpleMemberKey(val klass: IrType, val name: Name) {
|
||||
// TODO drop custom equals and hashCode when IrTypes will have right equals
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SimpleMemberKey
|
||||
|
||||
if (name != other.name) return false
|
||||
|
||||
return klass.isEqualTo(other.klass)
|
||||
}
|
||||
|
||||
override fun hashCode() = 31 * klass.toHashCode() + name.hashCode()
|
||||
}
|
||||
internal data class SimpleMemberKey(val klass: IrType, val name: Name)
|
||||
|
||||
enum class PrimitiveType {
|
||||
FLOATING_POINT_NUMBER,
|
||||
|
||||
Reference in New Issue
Block a user