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 2151d2c0d7a..ac1c7d94245 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 @@ -21,14 +21,14 @@ abstract class IrFunctionAccessExpression( override fun getValueArgument(index: Int): IrExpression? { if (index >= valueArgumentsCount) { - throw AssertionError("$this: No such value argument slot: $index") + throwNoSuchArgumentSlotException("value", index, valueArgumentsCount) } return argumentsByParameterIndex[index] } override fun putValueArgument(index: Int, valueArgument: IrExpression?) { if (index >= valueArgumentsCount) { - throw AssertionError("$this: No such value argument slot: $index") + throwNoSuchArgumentSlotException("value", index, valueArgumentsCount) } argumentsByParameterIndex[index] = valueArgument } 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 394038a7609..ce7396bdbc8 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 @@ -39,14 +39,14 @@ abstract class IrMemberAccessExpression(typeArgumentsCount: Int) : fun getTypeArgument(index: Int): IrType? { if (index >= typeArgumentsCount) { - throw AssertionError("$this: No such type argument slot: $index") + throwNoSuchArgumentSlotException("type", index, typeArgumentsCount) } return typeArgumentsByIndex[index] } fun putTypeArgument(index: Int, type: IrType?) { if (index >= typeArgumentsCount) { - throw AssertionError("$this: No such type argument slot: $index") + throwNoSuchArgumentSlotException("type", index, typeArgumentsCount) } typeArgumentsByIndex[index] = type } @@ -62,6 +62,13 @@ abstract class IrMemberAccessExpression(typeArgumentsCount: Int) : } } +internal fun IrMemberAccessExpression<*>.throwNoSuchArgumentSlotException(kind: String, index: Int, total: Int): Nothing { + throw AssertionError( + "No such $kind argument slot in ${this::class.java.simpleName}: $index (total=$total)" + + (symbol.signature?.let { ".\nSymbol: $it" } ?: "") + ) +} + fun IrMemberAccessExpression<*>.getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): IrType? = getTypeArgument(typeParameterDescriptor.index)