diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionAccessExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionAccessExpression.kt index f1bdec28a17..2151d2c0d7a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionAccessExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionAccessExpression.kt @@ -12,10 +12,13 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor abstract class IrFunctionAccessExpression( typeArgumentsCount: Int, - final override val valueArgumentsCount: Int, + valueArgumentsCount: Int, ) : IrMemberAccessExpression(typeArgumentsCount) { private val argumentsByParameterIndex: Array = arrayOfNulls(valueArgumentsCount) + final override val valueArgumentsCount: Int + get() = argumentsByParameterIndex.size + override fun getValueArgument(index: Int): IrExpression? { if (index >= valueArgumentsCount) { throw AssertionError("$this: No such value argument slot: $index") diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt index 7dcf3fdd119..394038a7609 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt @@ -20,9 +20,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.types.KotlinType -abstract class IrMemberAccessExpression( - val typeArgumentsCount: Int -) : IrDeclarationReference() { +abstract class IrMemberAccessExpression(typeArgumentsCount: Int) : IrDeclarationReference() { var dispatchReceiver: IrExpression? = null var extensionReceiver: IrExpression? = null @@ -37,6 +35,8 @@ abstract class IrMemberAccessExpression( private val typeArgumentsByIndex = arrayOfNulls(typeArgumentsCount) + val typeArgumentsCount: Int get() = typeArgumentsByIndex.size + fun getTypeArgument(index: Int): IrType? { if (index >= typeArgumentsCount) { throw AssertionError("$this: No such type argument slot: $index") diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrSimpleTypeImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrSimpleTypeImpl.kt index ba666ea3f9d..daecddcd6fd 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrSimpleTypeImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrSimpleTypeImpl.kt @@ -17,9 +17,11 @@ class IrSimpleTypeImpl( override val classifier: IrClassifierSymbol, override val hasQuestionMark: Boolean, override val arguments: List, - annotations: List, + override val annotations: List, override val abbreviation: IrTypeAbbreviation? = null -) : IrTypeBase(kotlinType, annotations, Variance.INVARIANT), IrSimpleType, IrTypeProjection { +) : IrTypeBase(kotlinType), IrSimpleType { + override val variance: Variance + get() = Variance.INVARIANT constructor( classifier: IrClassifierSymbol, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrTypeBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrTypeBase.kt index b484bae7f40..7fa13e944a9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrTypeBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/impl/IrTypeBase.kt @@ -11,32 +11,28 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.addToStdlib.safeAs -abstract class IrTypeBase( - val kotlinType: KotlinType?, - override val annotations: List, - override val variance: Variance -) : IrType, IrTypeProjection { +abstract class IrTypeBase(val kotlinType: KotlinType?) : IrType, IrTypeProjection { override val type: IrType get() = this } class IrErrorTypeImpl( kotlinType: KotlinType?, - annotations: List, - variance: Variance -) : IrTypeBase(kotlinType, annotations, variance), IrErrorType { + override val annotations: List, + override val variance: Variance, +) : IrTypeBase(kotlinType), IrErrorType { override fun equals(other: Any?): Boolean = other is IrErrorTypeImpl - override fun hashCode(): Int = IrErrorTypeImpl::class.java.name.hashCode() + override fun hashCode(): Int = IrErrorTypeImpl::class.java.hashCode() } class IrDynamicTypeImpl( kotlinType: KotlinType?, - annotations: List, - variance: Variance -) : IrTypeBase(kotlinType, annotations, variance), IrDynamicType, IrTypeProjection { + override val annotations: List, + override val variance: Variance, +) : IrTypeBase(kotlinType), IrDynamicType { override fun equals(other: Any?): Boolean = other is IrDynamicTypeImpl - override fun hashCode(): Int = IrDynamicTypeImpl::class.java.name.hashCode() + override fun hashCode(): Int = IrDynamicTypeImpl::class.java.hashCode() }