From 7ae6c55ddbba1b3a77f52d4efd7623a2780207d5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 19 Sep 2016 13:30:09 +0300 Subject: [PATCH] IrMemberAccessExpression::getTypeArgument --- .../psi2ir/builders/ExpressionHelpers.kt | 8 +-- .../generators/ArgumentsGenerationUtils.kt | 11 ++++ .../psi2ir/generators/AssignmentGenerator.kt | 2 +- .../kotlin/psi2ir/generators/BodyGenerator.kt | 2 +- .../kotlin/psi2ir/generators/CallGenerator.kt | 18 ++++--- .../psi2ir/generators/ClassGenerator.kt | 2 +- .../generators/DelegatedPropertyGenerator.kt | 2 +- .../psi2ir/generators/LocalClassGenerator.kt | 2 +- .../generators/LocalFunctionGenerator.kt | 4 +- .../ReflectionReferencesGenerator.kt | 4 +- .../psi2ir/generators/StatementGenerator.kt | 3 +- .../DelegatedLocalPropertyLValue.kt | 6 +-- .../intermediate/SimplePropertyLValue.kt | 8 +-- .../transformations/InsertImplicitCasts.kt | 4 +- .../expressions/IrMemberAccessExpression.kt | 22 ++++++-- .../kotlin/ir/expressions/impl/IrCallImpl.kt | 4 +- .../impl/IrCallWithIndexedArgumentsBase.kt | 10 ++-- .../impl/IrCallableReferenceImpl.kt | 5 +- .../impl/IrDelegatingConstructorCallImpl.kt | 8 ++- .../impl/IrEnumConstructorCallImpl.kt | 3 +- .../impl/IrMemberAccessExpressionBase.kt | 7 ++- .../ir/expressions/impl/IrPrimitiveCall.kt | 19 ++++--- .../impl/IrPropertyAccessorCall.kt | 53 ++++++++++++------- .../jetbrains/kotlin/ir/util/DumpIrTree.kt | 13 ++++- .../declarations/classLevelProperties.txt | 6 +++ .../declarations/delegatedProperties.txt | 10 ++++ .../declarations/localDelegatedProperties.txt | 6 +++ .../declarations/packageLevelProperties.txt | 6 +++ .../ir/irText/expressions/typeArguments.kt | 4 ++ .../ir/irText/expressions/typeArguments.txt | 12 +++++ .../testData/ir/irText/expressions/vararg.txt | 3 ++ .../testData/ir/irText/expressions/when.txt | 4 ++ .../ir/irText/lambdas/extensionLambda.txt | 2 + .../lambdas/multipleImplicitReceivers.txt | 6 +++ .../ir/irText/lambdas/nonLocalReturn.txt | 5 ++ .../kotlin/ir/IrTextTestCaseGenerated.java | 6 +++ 36 files changed, 219 insertions(+), 71 deletions(-) create mode 100644 compiler/testData/ir/irText/expressions/typeArguments.kt create mode 100644 compiler/testData/ir/irText/expressions/typeArguments.txt diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/builders/ExpressionHelpers.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/builders/ExpressionHelpers.kt index 3b750d15330..d141f0399f7 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/builders/ExpressionHelpers.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/builders/ExpressionHelpers.kt @@ -102,15 +102,15 @@ fun IrBuilderWithScope.irNotEquals(arg1: IrExpression, arg2: IrExpression) = arg1, arg2)) fun IrBuilderWithScope.irGet(receiver: IrExpression, property: PropertyDescriptor): IrExpression = - IrGetterCallImpl(startOffset, endOffset, property.getter!!, receiver, null, IrStatementOrigin.GET_PROPERTY) + IrGetterCallImpl(startOffset, endOffset, property.getter!!, null, receiver, null, IrStatementOrigin.GET_PROPERTY) fun IrBuilderWithScope.irCall(callee: CallableDescriptor) = - IrCallImpl(startOffset, endOffset, callee.returnType!!, callee) + IrCallImpl(startOffset, endOffset, callee.returnType!!, callee, null) fun IrBuilderWithScope.irCallOp(callee: CallableDescriptor, dispatchReceiver: IrExpression, argument: IrExpression) = - IrCallImpl(startOffset, endOffset, callee.returnType!!, callee).apply { + IrCallImpl(startOffset, endOffset, callee.returnType!!, callee, null).apply { this.dispatchReceiver = dispatchReceiver - putArgument(0, argument) + putValueArgument(0, argument) } fun IrBuilderWithScope.irNotIs(argument: IrExpression, type: KotlinType) = diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt index b1e70f62b1f..525b990afe2 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* @@ -29,6 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.callResolverUtil.getSuperCallExpressio import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.resolve.scopes.receivers.* +import org.jetbrains.kotlin.types.KotlinType import java.lang.AssertionError fun StatementGenerator.generateReceiverOrNull(ktDefaultElement: KtElement, receiver: ReceiverValue?): IntermediateValue? = @@ -150,6 +152,15 @@ fun StatementGenerator.pregenerateCall(resolvedCall: ResolvedCall<*>): CallBuild return call } +fun getTypeArguments(resolvedCall: ResolvedCall<*>?): Map? { + if (resolvedCall == null) return null + + val descriptor = resolvedCall.resultingDescriptor + if (descriptor.typeParameters.isEmpty()) return null + + return resolvedCall.typeArguments +} + private fun StatementGenerator.pregenerateValueArguments(call: CallBuilder, resolvedCall: ResolvedCall<*>) { resolvedCall.valueArgumentsByIndex!!.forEachIndexed { index, valueArgument -> val valueParameter = call.descriptor.valueParameters[index] diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt index 4169fe23df2..7eaaab6976f 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt @@ -150,7 +150,7 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen val superQualifier = getSuperQualifier(resolvedCall) return SimplePropertyLValue(context, scope, ktLeft.startOffset, ktLeft.endOffset, origin, descriptor, - propertyReceiver, superQualifier) + getTypeArguments(resolvedCall), propertyReceiver, superQualifier) } private fun isValInitializationInConstructor(descriptor: PropertyDescriptor, resolvedCall: ResolvedCall<*>): Boolean = diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt index a8b704190bf..4ac352ffcfe 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt @@ -224,7 +224,7 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context: private fun generateAnySuperConstructorCAll(irBlockBody: IrBlockBodyImpl, ktElement: KtElement) { val anyConstructor = context.builtIns.any.constructors.single() - irBlockBody.statements.add(IrDelegatingConstructorCallImpl(ktElement.startOffset, ktElement.endOffset, anyConstructor)) + irBlockBody.statements.add(IrDelegatingConstructorCallImpl(ktElement.startOffset, ktElement.endOffset, anyConstructor, null)) } private fun generateEnumSuperConstructorCall(irBlockBody: IrBlockBodyImpl, ktElement: KtElement) { diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt index 7f55270f714..947e975ae51 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt @@ -37,7 +37,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE generatePropertyGetterCall(descriptor, startOffset, endOffset, call) is VariableDescriptor -> call.callReceiver.call { dispatchReceiverValue, extensionReceiverValue -> - generateGetVariable(startOffset, endOffset, descriptor, origin) + generateGetVariable(startOffset, endOffset, descriptor, getTypeArguments(call.original), origin) } is FunctionDescriptor -> generateFunctionCall(descriptor, startOffset, endOffset, origin, call) @@ -46,9 +46,12 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE } } - fun generateGetVariable(startOffset: Int, endOffset: Int, descriptor: VariableDescriptor, origin: IrStatementOrigin? = null) = + fun generateGetVariable(startOffset: Int, endOffset: Int, + descriptor: VariableDescriptor, + typeArguments: Map?, + origin: IrStatementOrigin? = null) = if (descriptor is LocalVariableDescriptor && descriptor.isDelegated) - IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY) + IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, typeArguments, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY) else IrGetVariableImpl(startOffset, endOffset, descriptor, origin) @@ -57,7 +60,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE if (descriptor !is ConstructorDescriptor) throw AssertionError("Constructor expected: $descriptor") return call.callReceiver.call { dispatchReceiver, extensionReceiver -> - val irCall = IrDelegatingConstructorCallImpl(startOffset, endOffset, descriptor) + val irCall = IrDelegatingConstructorCallImpl(startOffset, endOffset, descriptor, getTypeArguments(call.original)) irCall.dispatchReceiver = dispatchReceiver?.load() irCall.extensionReceiver = extensionReceiver?.load() addParametersToCall(startOffset, endOffset, call, irCall, descriptor.returnType) @@ -88,6 +91,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE return call.callReceiver.call { dispatchReceiverValue, extensionReceiverValue -> descriptor.getter?.let { getter -> IrGetterCallImpl(startOffset, endOffset, getter, + getTypeArguments(call.original), dispatchReceiverValue?.load(), extensionReceiverValue?.load(), IrStatementOrigin.GET_PROPERTY, @@ -108,7 +112,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE val returnType = descriptor.returnType!! return call.callReceiver.call { dispatchReceiverValue, extensionReceiverValue -> - val irCall = IrCallImpl(startOffset, endOffset, returnType, descriptor, origin, call.superQualifier) + val irCall = IrCallImpl(startOffset, endOffset, returnType, descriptor, getTypeArguments(call.original), origin, call.superQualifier) irCall.dispatchReceiver = dispatchReceiverValue?.load() irCall.extensionReceiver = extensionReceiverValue?.load() @@ -123,7 +127,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE else { val valueArguments = call.getValueArgumentsInParameterOrder() for ((index, valueArgument) in valueArguments.withIndex()) { - irCall.putArgument(index, valueArgument) + irCall.putValueArgument(index, valueArgument) } irCall } @@ -159,7 +163,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE resolvedCall.valueArgumentsByIndex!!.forEachIndexed { index, valueArgument -> val valueParameter = valueParameters[index] - irCall.putArgument(index, irArgumentValues[valueParameter]?.load()) + irCall.putValueArgument(index, irArgumentValues[valueParameter]?.load()) } irBlock.statements.add(irCall) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index 2c26352e176..c11f8b03dfa 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -163,7 +163,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator private fun generateDelegateFunctionBody(irDelegate: IrFieldImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrBlockBodyImpl { val irBlockBody = IrBlockBodyImpl(irDelegate.startOffset, irDelegate.endOffset) val returnType = overridden.returnType!! - val irCall = IrCallImpl(irDelegate.startOffset, irDelegate.endOffset, returnType, overridden) + val irCall = IrCallImpl(irDelegate.startOffset, irDelegate.endOffset, returnType, overridden, null) irCall.dispatchReceiver = IrGetVariableImpl(irDelegate.startOffset, irDelegate.endOffset, irDelegate.descriptor) irCall.extensionReceiver = delegated.extensionReceiverParameter?.let { extensionReceiver -> IrGetExtensionReceiverImpl(irDelegate.startOffset, irDelegate.endOffset, extensionReceiver) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt index edf781bf1b9..37006257950 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt @@ -89,7 +89,7 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener private fun createCallableReference(ktElement: KtElement, type: KotlinType, referencedDescriptor: CallableDescriptor): IrCallableReference = IrCallableReferenceImpl(ktElement.startOffset, ktElement.endOffset, type, - referencedDescriptor, IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE) + referencedDescriptor, null, IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE) fun generateLocalDelegatedProperty( ktProperty: KtProperty, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalClassGenerator.kt index 9ee504c9adb..1aea6c1dc71 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalClassGenerator.kt @@ -46,7 +46,7 @@ class LocalClassGenerator(statementGenerator: StatementGenerator): StatementGene } irBlock.statements.add(IrCallImpl(ktObjectLiteral.startOffset, ktObjectLiteral.endOffset, objectLiteralType, - objectConstructor, IrStatementOrigin.OBJECT_LITERAL)) + objectConstructor, null, IrStatementOrigin.OBJECT_LITERAL)) return irBlock } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt index 40279000f07..3be5da340da 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt @@ -41,7 +41,7 @@ class LocalFunctionGenerator(statementGenerator: StatementGenerator) : Statement irBlock.statements.add(irFun) irBlock.statements.add(IrCallableReferenceImpl(ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, - lambdaDescriptor, IrStatementOrigin.LAMBDA)) + lambdaDescriptor, null, IrStatementOrigin.LAMBDA)) return irBlock } @@ -59,7 +59,7 @@ class LocalFunctionGenerator(statementGenerator: StatementGenerator) : Statement irBlock.statements.add(irFun) irBlock.statements.add(IrCallableReferenceImpl(ktFun.startOffset, ktFun.endOffset, funExpressionType, - irFun.descriptor, IrStatementOrigin.ANONYMOUS_FUNCTION)) + irFun.descriptor, null, IrStatementOrigin.ANONYMOUS_FUNCTION)) irBlock } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index 51a4422097e..7569b4afea0 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -50,8 +50,8 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St fun generateCallableReference(ktCallableReference: KtCallableReferenceExpression): IrExpression { val resolvedCall = getResolvedCall(ktCallableReference.callableReference)!! val irCallableRef = IrCallableReferenceImpl(ktCallableReference.startOffset, ktCallableReference.endOffset, - getInferredTypeWithImplicitCastsOrFail(ktCallableReference), - resolvedCall.resultingDescriptor) + getInferredTypeWithImplicitCastsOrFail(ktCallableReference), + resolvedCall.resultingDescriptor, null) resolvedCall.dispatchReceiver?.let { dispatchReceiver -> if (dispatchReceiver !is TransientReceiver) { irCallableRef.dispatchReceiver = statementGenerator.generateReceiver(ktCallableReference, dispatchReceiver).load() diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt index 97ed690a6b7..d1869be5a08 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt @@ -275,7 +275,8 @@ class StatementGenerator( CallGenerator(this).generateCall(expression.startOffset, expression.endOffset, pregenerateCall(resolvedCall!!)) } is VariableDescriptor -> - CallGenerator(this).generateGetVariable(expression.startOffset, expression.endOffset, descriptor) + CallGenerator(this).generateGetVariable(expression.startOffset, expression.endOffset, descriptor, + getTypeArguments(resolvedCall)) else -> IrErrorExpressionImpl( expression.startOffset, expression.endOffset, getInferredTypeWithImplicitCastsOrFail(expression), diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/DelegatedLocalPropertyLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/DelegatedLocalPropertyLValue.kt index 8da2d31460e..4b77a0e6de6 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/DelegatedLocalPropertyLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/DelegatedLocalPropertyLValue.kt @@ -31,11 +31,11 @@ class DelegatedLocalPropertyLValue( override val type: KotlinType get() = descriptor.type override fun load(): IrExpression = - IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, origin) + IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, null, origin) override fun store(irExpression: IrExpression): IrExpression = - IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.setter!!, origin).apply { - putArgument(0, irExpression) + IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.setter!!, null, origin).apply { + putValueArgument(0, irExpression) } override fun assign(withLValue: (LValue) -> IrExpression): IrExpression = diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt index 0049121a369..e3367e01331 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.psi2ir.intermediate import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext @@ -31,6 +32,7 @@ class SimplePropertyLValue( val endOffset: Int, val origin: IrStatementOrigin?, val descriptor: PropertyDescriptor, + val typeArguments: Map?, val callReceiver: CallReceiver, val superQualifier: ClassDescriptor? ) : LValue, AssignmentReceiver { @@ -39,7 +41,7 @@ class SimplePropertyLValue( override fun load(): IrExpression = callReceiver.call { dispatchReceiverValue, extensionReceiverValue -> descriptor.getter?.let { getter -> - IrGetterCallImpl(startOffset, endOffset, getter, + IrGetterCallImpl(startOffset, endOffset, getter, typeArguments, dispatchReceiverValue?.load(), extensionReceiverValue?.load(), origin, @@ -51,7 +53,7 @@ class SimplePropertyLValue( override fun store(irExpression: IrExpression) = callReceiver.call { dispatchReceiverValue, extensionReceiverValue -> descriptor.setter?.let { setter -> - IrSetterCallImpl(startOffset, endOffset, setter, + IrSetterCallImpl(startOffset, endOffset, setter, typeArguments, dispatchReceiverValue?.load(), extensionReceiverValue?.load(), irExpression, @@ -74,7 +76,7 @@ class SimplePropertyLValue( val extensionReceiverValue2 = extensionReceiverTmp?.let { VariableLValue(it) } val irResultExpression = withLValue( - SimplePropertyLValue(context, scope, startOffset, endOffset, origin, descriptor, + SimplePropertyLValue(context, scope, startOffset, endOffset, origin, descriptor, typeArguments, SimpleCallReceiver(dispatchReceiverValue2, extensionReceiverValue2), superQualifier) ) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt index 4b07e822b12..b52faa246f6 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt @@ -47,9 +47,9 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi dispatchReceiver = dispatchReceiver?.cast(descriptor.dispatchReceiverParameter?.type) extensionReceiver = extensionReceiver?.cast(descriptor.extensionReceiverParameter?.type) for (index in descriptor.valueParameters.indices) { - val argument = getArgument(index) ?: continue + val argument = getValueArgument(index) ?: continue val parameterType = descriptor.valueParameters[index].type - putArgument(index, argument.cast(parameterType)) + putValueArgument(index, argument.cast(parameterType)) } } 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 609a9d5c8c3..d1c5e84f028 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 @@ -17,7 +17,9 @@ package org.jetbrains.kotlin.ir.expressions import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.types.KotlinType interface IrMemberAccessExpression : IrDeclarationReference { var dispatchReceiver: IrExpression? @@ -26,15 +28,27 @@ interface IrMemberAccessExpression : IrDeclarationReference { val origin: IrStatementOrigin? override val descriptor: CallableDescriptor - fun getArgument(index: Int): IrExpression? - fun putArgument(index: Int, valueArgument: IrExpression?) - fun removeArgument(index: Int) + fun getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): KotlinType? + + fun getValueArgument(index: Int): IrExpression? + fun putValueArgument(index: Int, valueArgument: IrExpression?) + fun removeValueArgument(index: Int) } +fun IrMemberAccessExpression.getValueArgument(valueParameterDescriptor: ValueParameterDescriptor) = + getValueArgument(valueParameterDescriptor.index) + +fun IrMemberAccessExpression.putValueArgument(valueParameterDescriptor: ValueParameterDescriptor, valueArgument: IrExpression?) { + putValueArgument(valueParameterDescriptor.index, valueArgument) +} + +fun IrMemberAccessExpression.removeValueArgument(valueParameterDescriptor: ValueParameterDescriptor) { + removeValueArgument(valueParameterDescriptor.index) +} inline fun T.mapValueParameters(transform: (ValueParameterDescriptor) -> IrExpression): T { descriptor.valueParameters.forEach { - putArgument(it.index, transform(it)) + putValueArgument(it.index, transform(it)) } return this } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt index 68494fff3cf..936d2817cd3 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.visitors.IrElementVisitor @@ -28,9 +29,10 @@ class IrCallImpl( endOffset: Int, type: KotlinType, override val descriptor: CallableDescriptor, + typeArguments: Map?, override val origin: IrStatementOrigin? = null, override val superQualifier: ClassDescriptor? = null -) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, type, descriptor.valueParameters.size), IrCall { +) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, type, descriptor.valueParameters.size, typeArguments), IrCall { override fun accept(visitor: IrElementVisitor, data: D): R = visitor.visitCall(this, data) } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallWithIndexedArgumentsBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallWithIndexedArgumentsBase.kt index 6431ebe8ac5..ec491089ea7 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallWithIndexedArgumentsBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallWithIndexedArgumentsBase.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.ir.expressions.impl +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.visitors.IrElementTransformer @@ -26,22 +27,23 @@ import java.lang.AssertionError abstract class IrCallWithIndexedArgumentsBase( startOffset: Int, endOffset: Int, type: KotlinType, numArguments: Int, + typeArguments: Map?, override val origin: IrStatementOrigin? = null -) : IrMemberAccessExpressionBase(startOffset, endOffset, type) { +) : IrMemberAccessExpressionBase(startOffset, endOffset, type, typeArguments) { protected val argumentsByParameterIndex = arrayOfNulls(numArguments) - override fun getArgument(index: Int): IrExpression? = + override fun getValueArgument(index: Int): IrExpression? = argumentsByParameterIndex[index] - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { if (index >= argumentsByParameterIndex.size) { throw AssertionError("$this: No such argument slot: $index") } argumentsByParameterIndex[index] = valueArgument } - override fun removeArgument(index: Int) { + override fun removeValueArgument(index: Int) { argumentsByParameterIndex[index] = null } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallableReferenceImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallableReferenceImpl.kt index be4d0c7d758..0d8bcabbaba 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallableReferenceImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallableReferenceImpl.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrCallableReference import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.visitors.IrElementVisitor @@ -27,8 +28,10 @@ class IrCallableReferenceImpl( endOffset: Int, type: KotlinType, override val descriptor: CallableDescriptor, + typeArguments: Map?, override val origin: IrStatementOrigin? = null -) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, type, descriptor.valueParameters.size, origin), IrCallableReference { +) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, type, descriptor.valueParameters.size, typeArguments, origin), + IrCallableReference { override fun accept(visitor: IrElementVisitor, data: D): R { return visitor.visitCallableReference(this, data) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDelegatingConstructorCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDelegatingConstructorCallImpl.kt index 262f5dde242..f18d20330ce 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDelegatingConstructorCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDelegatingConstructorCallImpl.kt @@ -17,14 +17,18 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.ConstructorDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall import org.jetbrains.kotlin.ir.visitors.IrElementVisitor +import org.jetbrains.kotlin.types.KotlinType class IrDelegatingConstructorCallImpl( startOffset: Int, endOffset: Int, - override val descriptor: ConstructorDescriptor -) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size), IrDelegatingConstructorCall { + override val descriptor: ConstructorDescriptor, + typeArguments: Map? +) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size, typeArguments), + IrDelegatingConstructorCall { override fun accept(visitor: IrElementVisitor, data: D): R { return visitor.visitDelegatingConstructorCall(this, data) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrEnumConstructorCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrEnumConstructorCallImpl.kt index 9753bda437e..157fa325120 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrEnumConstructorCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrEnumConstructorCallImpl.kt @@ -26,7 +26,8 @@ class IrEnumConstructorCallImpl( endOffset: Int, override val descriptor: ConstructorDescriptor, override val enumEntryDescriptor: ClassDescriptor? = null -) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size), IrEnumConstructorCall { +) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size, null), + IrEnumConstructorCall { override fun accept(visitor: IrElementVisitor, data: D): R { return visitor.visitEnumConstructorCall(this, data) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrMemberAccessExpressionBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrMemberAccessExpressionBase.kt index 82ae3f045e4..ed92f1759ba 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrMemberAccessExpressionBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrMemberAccessExpressionBase.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.ir.expressions.impl +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.visitors.IrElementTransformer @@ -25,11 +26,15 @@ import org.jetbrains.kotlin.types.KotlinType abstract class IrMemberAccessExpressionBase( startOffset: Int, endOffset: Int, - type: KotlinType + type: KotlinType, + private val typeArguments: Map? ) : IrExpressionBase(startOffset, endOffset, type), IrMemberAccessExpression { override var dispatchReceiver: IrExpression? = null override var extensionReceiver: IrExpression? = null + override fun getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): KotlinType? = + typeArguments?.get(typeParameterDescriptor) + override fun acceptChildren(visitor: IrElementVisitor, data: D) { dispatchReceiver?.accept(visitor, data) extensionReceiver?.accept(visitor, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPrimitiveCall.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPrimitiveCall.kt index 08ca6cfe0e6..8ba95763d2a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPrimitiveCall.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPrimitiveCall.kt @@ -18,12 +18,14 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.* import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementVisitor +import org.jetbrains.kotlin.types.KotlinType import java.lang.UnsupportedOperationException abstract class IrPrimitiveCallBase( @@ -47,7 +49,10 @@ abstract class IrPrimitiveCallBase( throw UnsupportedOperationException("Operator call expression can't have a receiver") } - override fun removeArgument(index: Int) { + override fun getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): KotlinType? = + null // IR primitives have no type parameters + + override fun removeValueArgument(index: Int) { throw AssertionError("Operator call expression can't have a default argument") } @@ -63,9 +68,9 @@ abstract class IrPrimitiveCallBase( class IrNullaryPrimitiveImpl constructor(startOffset: Int, endOffset: Int, origin: IrStatementOrigin, descriptor: CallableDescriptor) : IrPrimitiveCallBase(startOffset, endOffset, origin, descriptor) { - override fun getArgument(index: Int): IrExpression? = null + override fun getValueArgument(index: Int): IrExpression? = null - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { throw UnsupportedOperationException("Nullary operator $descriptor doesn't have arguments") } @@ -88,14 +93,14 @@ class IrUnaryPrimitiveImpl private constructor(startOffset: Int, endOffset: Int, lateinit var argument: IrExpression - override fun getArgument(index: Int): IrExpression? { + override fun getValueArgument(index: Int): IrExpression? { return when (index) { ARGUMENT0 -> argument else -> null } } - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { when (index) { ARGUMENT0 -> argument = valueArgument ?: throw AssertionError("Primitive call $descriptor argument is null") else -> throw AssertionError("Primitive call $descriptor: no such argument index $index") @@ -124,7 +129,7 @@ class IrBinaryPrimitiveImpl(startOffset: Int, endOffset: Int, origin: IrStatemen lateinit var argument0: IrExpression lateinit var argument1: IrExpression - override fun getArgument(index: Int): IrExpression? { + override fun getValueArgument(index: Int): IrExpression? { return when (index) { ARGUMENT0 -> argument0 ARGUMENT1 -> argument1 @@ -132,7 +137,7 @@ class IrBinaryPrimitiveImpl(startOffset: Int, endOffset: Int, origin: IrStatemen } } - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { val argument = valueArgument ?: throw AssertionError("Primitive call $descriptor argument is null") when (index) { ARGUMENT0 -> argument0 = argument diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPropertyAccessorCall.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPropertyAccessorCall.kt index b10f750d74c..13b4d3e7043 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPropertyAccessorCall.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrPropertyAccessorCall.kt @@ -18,19 +18,22 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.visitors.IrElementVisitor +import org.jetbrains.kotlin.types.KotlinType import java.lang.AssertionError import java.lang.UnsupportedOperationException abstract class IrPropertyAccessorCallBase( startOffset: Int, endOffset: Int, override val descriptor: CallableDescriptor, + typeArguments: Map?, override val origin: IrStatementOrigin? = null, override val superQualifier: ClassDescriptor? = null -) : IrMemberAccessExpressionBase(startOffset, endOffset, descriptor.returnType!!), IrCall { +) : IrMemberAccessExpressionBase(startOffset, endOffset, descriptor.returnType!!, typeArguments), IrCall { override fun accept(visitor: IrElementVisitor, data: D): R { return visitor.visitCall(this, data) } @@ -40,58 +43,68 @@ abstract class IrPropertyAccessorCallBase( } } -class IrGetterCallImpl(startOffset: Int, endOffset: Int, descriptor: CallableDescriptor, - origin: IrStatementOrigin? = null, - superQualifier: ClassDescriptor? = null -) : IrPropertyAccessorCallBase(startOffset, endOffset, descriptor, origin, superQualifier), IrCall { - constructor(startOffset: Int, endOffset: Int, descriptor: CallableDescriptor, +class IrGetterCallImpl( + startOffset: Int, endOffset: Int, + descriptor: CallableDescriptor, + typeArguments: Map?, + origin: IrStatementOrigin? = null, + superQualifier: ClassDescriptor? = null +) : IrPropertyAccessorCallBase(startOffset, endOffset, descriptor, typeArguments, origin, superQualifier), IrCall { + constructor(startOffset: Int, endOffset: Int, + descriptor: CallableDescriptor, + typeArguments: Map?, dispatchReceiver: IrExpression?, extensionReceiver: IrExpression?, origin: IrStatementOrigin? = null, superQualifier: ClassDescriptor? = null - ) : this(startOffset, endOffset, descriptor, origin, superQualifier) { + ) : this(startOffset, endOffset, descriptor, typeArguments, origin, superQualifier) { this.dispatchReceiver = dispatchReceiver this.extensionReceiver = extensionReceiver } - override fun getArgument(index: Int): IrExpression? = null + override fun getValueArgument(index: Int): IrExpression? = null - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { throw UnsupportedOperationException("Property setter call has no arguments") } - override fun removeArgument(index: Int) { + override fun removeValueArgument(index: Int) { throw UnsupportedOperationException("Property getter call has no arguments") } } -class IrSetterCallImpl(startOffset: Int, endOffset: Int, descriptor: CallableDescriptor, - origin: IrStatementOrigin? = null, - superQualifier: ClassDescriptor? = null -) : IrPropertyAccessorCallBase(startOffset, endOffset, descriptor, origin, superQualifier), IrCall { - constructor(startOffset: Int, endOffset: Int, descriptor: CallableDescriptor, +class IrSetterCallImpl( + startOffset: Int, endOffset: Int, + descriptor: CallableDescriptor, + typeArguments: Map?, + origin: IrStatementOrigin? = null, + superQualifier: ClassDescriptor? = null +) : IrPropertyAccessorCallBase(startOffset, endOffset, descriptor, typeArguments, origin, superQualifier), IrCall { + constructor(startOffset: Int, endOffset: Int, + descriptor: CallableDescriptor, + typeArguments: Map?, dispatchReceiver: IrExpression?, extensionReceiver: IrExpression?, argument: IrExpression, origin: IrStatementOrigin? = null, superQualifier: ClassDescriptor? = null - ) : this(startOffset, endOffset, descriptor, origin, superQualifier) { + ) : this(startOffset, endOffset, descriptor, typeArguments, origin, superQualifier) { this.dispatchReceiver = dispatchReceiver this.extensionReceiver = extensionReceiver - putArgument(SETTER_ARGUMENT_INDEX, argument) + putValueArgument(SETTER_ARGUMENT_INDEX, argument) } private var argumentImpl: IrExpression? = null - override fun getArgument(index: Int): IrExpression? = + override fun getValueArgument(index: Int): IrExpression? = if (index == SETTER_ARGUMENT_INDEX) argumentImpl!! else null - override fun putArgument(index: Int, valueArgument: IrExpression?) { + override fun putValueArgument(index: Int, valueArgument: IrExpression?) { if (index != SETTER_ARGUMENT_INDEX) throw AssertionError("Property setter call $descriptor has no argument $index") argumentImpl = valueArgument } - override fun removeArgument(index: Int) { + override fun removeValueArgument(index: Int) { if (index != SETTER_ARGUMENT_INDEX) throw AssertionError("Property setter call $descriptor has no argument $index") argumentImpl = null } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt index dd3a766e560..55578a168e8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -97,14 +97,25 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { override fun visitMemberAccess(expression: IrMemberAccessExpression, data: String) { expression.dumpLabeledElementWith(data) { + dumpTypeArguments(expression) + expression.dispatchReceiver?.accept(this, "\$this") expression.extensionReceiver?.accept(this, "\$receiver") for (valueParameter in expression.descriptor.valueParameters) { - expression.getArgument(valueParameter.index)?.accept(this, valueParameter.name.asString()) + expression.getValueArgument(valueParameter.index)?.accept(this, valueParameter.name.asString()) } } } + private fun dumpTypeArguments(expression: IrMemberAccessExpression) { + for (typeParameter in expression.descriptor.original.typeParameters) { + val typeArgument = expression.getTypeArgument(typeParameter) ?: continue + val renderedParameter = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES.render(typeParameter) + val renderedType = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES.renderType(typeArgument) + printer.println("$renderedParameter: $renderedType") + } + } + override fun visitGetField(expression: IrGetField, data: String) { expression.dumpLabeledElementWith(data) { expression.receiver?.accept(this, "receiver") diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.txt index 3cefce1ffdf..bbb39044407 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.txt @@ -72,6 +72,7 @@ FILE /classLevelProperties.kt FIELD DELEGATE val `test7$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy origin=null + : Int initializer: BLOCK type=() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Int BLOCK_BODY @@ -82,6 +83,7 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test7$delegate`: Lazy' type=kotlin.Lazy origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C @@ -90,10 +92,13 @@ FILE /classLevelProperties.kt FIELD DELEGATE val `test8$delegate`: java.util.HashMap EXPRESSION_BODY CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap origin=null + : String + : Int FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test8$delegate`: HashMap' type=java.util.HashMap origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C @@ -102,6 +107,7 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(Int): Unit' CALL 'setValue(Any?, KProperty<*>, Int) on MutableMap: Unit' type=kotlin.Unit origin=null + : Int $receiver: GET_FIELD '`test8$delegate`: HashMap' type=java.util.HashMap origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.txt index f6b8e65c519..5d33d30a281 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.txt @@ -3,6 +3,7 @@ FILE /delegatedProperties.kt FIELD DELEGATE val `test1$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy origin=null + : Int initializer: BLOCK type=() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Int BLOCK_BODY @@ -13,6 +14,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test1$delegate`: Lazy' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test1: Int' type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -34,6 +36,7 @@ FILE /delegatedProperties.kt FIELD DELEGATE val `test2$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy origin=null + : Int initializer: BLOCK type=() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Int BLOCK_BODY @@ -44,6 +47,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test2$delegate`: Lazy' type=kotlin.Lazy origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C @@ -57,6 +61,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Any' type=kotlin.Any origin=null + : Any $receiver: GET_FIELD '`test3$delegate`: MutableMap' type=kotlin.collections.MutableMap origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C @@ -65,6 +70,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit origin=null + : Any $receiver: GET_FIELD '`test3$delegate`: MutableMap' type=kotlin.collections.MutableMap origin=null receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C @@ -74,10 +80,13 @@ FILE /delegatedProperties.kt FIELD DELEGATE val `test4$delegate`: java.util.HashMap EXPRESSION_BODY CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap origin=null + : String + : Any FUN DELEGATED_PROPERTY_ACCESSOR public fun (): kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Any' type=kotlin.Any origin=null + : Any $receiver: GET_FIELD '`test4$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test4: Any' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -85,6 +94,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit origin=null + : Any $receiver: GET_FIELD '`test4$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test4: Any' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt index da648035912..294c73afd56 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt @@ -4,6 +4,7 @@ FILE /localDelegatedProperties.kt LOCAL_DELEGATED_PROPERTY val x: kotlin.Int VAR DELEGATE val `x$delegate`: kotlin.Lazy CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy origin=null + : Int initializer: BLOCK type=() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Int BLOCK_BODY @@ -14,6 +15,7 @@ FILE /localDelegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null + : Int $receiver: GET_VAR '`x$delegate`: Lazy' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -24,10 +26,13 @@ FILE /localDelegatedProperties.kt LOCAL_DELEGATED_PROPERTY var x: kotlin.Int VAR DELEGATE val `x$delegate`: java.util.HashMap CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap origin=null + : String + : Int FUN DELEGATED_PROPERTY_ACCESSOR local final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Int' type=kotlin.Int origin=null + : Int $receiver: GET_VAR '`x$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -36,6 +41,7 @@ FILE /localDelegatedProperties.kt RETURN type=kotlin.Nothing from='(Int): Int' TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Int CALL 'setValue(Any?, KProperty<*>, Int) on MutableMap: Unit' type=kotlin.Unit origin=null + : Int $receiver: GET_VAR '`x$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt index 38ac8bfc177..549e2fcd1f4 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt @@ -60,6 +60,7 @@ FILE /packageLevelProperties.kt FIELD DELEGATE val `test7$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy origin=null + : Int initializer: BLOCK type=() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Int BLOCK_BODY @@ -70,6 +71,7 @@ FILE /packageLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test7$delegate`: Lazy' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test7: Int' type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -77,10 +79,13 @@ FILE /packageLevelProperties.kt FIELD DELEGATE val `test8$delegate`: java.util.HashMap EXPRESSION_BODY CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap origin=null + : String + : Int FUN DELEGATED_PROPERTY_ACCESSOR public fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Int' type=kotlin.Int origin=null + : Int $receiver: GET_FIELD '`test8$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -88,6 +93,7 @@ FILE /packageLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(Int): Unit' CALL 'setValue(Any?, KProperty<*>, Int) on MutableMap: Unit' type=kotlin.Unit origin=null + : Int $receiver: GET_FIELD '`test8$delegate`: HashMap' type=java.util.HashMap origin=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/expressions/typeArguments.kt b/compiler/testData/ir/irText/expressions/typeArguments.kt new file mode 100644 index 00000000000..d3729ec6044 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeArguments.kt @@ -0,0 +1,4 @@ +// WITH_RUNTIME + +fun test1(x: Any) = + x is Array<*> && x.isArrayOf() \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/typeArguments.txt b/compiler/testData/ir/irText/expressions/typeArguments.txt new file mode 100644 index 00000000000..598362dab35 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/typeArguments.txt @@ -0,0 +1,12 @@ +FILE /typeArguments.kt + FUN public fun test1(x: kotlin.Any): kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='test1(Any): Boolean' + WHEN type=kotlin.Boolean origin=ANDAND + if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Array<*> + GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null + then: CALL 'isArrayOf() on Array<*>: Boolean' type=kotlin.Boolean origin=null + : String + $receiver: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Array<*> + GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null + else: CONST Boolean type=kotlin.Boolean value='false' diff --git a/compiler/testData/ir/irText/expressions/vararg.txt b/compiler/testData/ir/irText/expressions/vararg.txt index d0cab9e6ee4..e9e32ced813 100644 --- a/compiler/testData/ir/irText/expressions/vararg.txt +++ b/compiler/testData/ir/irText/expressions/vararg.txt @@ -3,6 +3,7 @@ FILE /vararg.kt FIELD PROPERTY_BACKING_FIELD public val test1: kotlin.Array EXPRESSION_BODY CALL 'arrayOf(vararg String): Array' type=kotlin.Array origin=null + : String FUN DEFAULT_PROPERTY_ACCESSOR public fun (): kotlin.Array BLOCK_BODY RETURN type=kotlin.Nothing from='(): Array' @@ -11,6 +12,7 @@ FILE /vararg.kt FIELD PROPERTY_BACKING_FIELD public val test2: kotlin.Array EXPRESSION_BODY CALL 'arrayOf(vararg String): Array' type=kotlin.Array origin=null + : String elements: VARARG type=Array varargElementType=String CONST String type=kotlin.String value='1' CONST String type=kotlin.String value='2' @@ -23,6 +25,7 @@ FILE /vararg.kt FIELD PROPERTY_BACKING_FIELD public val test3: kotlin.Array EXPRESSION_BODY CALL 'arrayOf(vararg String): Array' type=kotlin.Array origin=null + : String elements: VARARG type=Array varargElementType=String CONST String type=kotlin.String value='0' SPREAD_ELEMENT diff --git a/compiler/testData/ir/irText/expressions/when.txt b/compiler/testData/ir/irText/expressions/when.txt index 969058a7b9c..4ef411b64a9 100644 --- a/compiler/testData/ir/irText/expressions/when.txt +++ b/compiler/testData/ir/irText/expressions/when.txt @@ -23,7 +23,9 @@ FILE /when.kt GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value='String' if: CALL 'contains(Any) on Iterable: Boolean' type=kotlin.Boolean origin=IN + : Any $receiver: CALL 'setOf(): Set' type=kotlin.collections.Set origin=null + : Nothing element: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value='nothingness?' else: CONST String type=kotlin.String value='something' @@ -43,7 +45,9 @@ FILE /when.kt GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value='String' if: CALL 'contains(Any) on Iterable: Boolean' type=kotlin.Boolean origin=IN + : Any $receiver: CALL 'setOf(): Set' type=kotlin.collections.Set origin=null + : Nothing element: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value='nothingness?' else: CONST String type=kotlin.String value='something' diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.txt index 456a7966f5a..2867d60991a 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.txt @@ -3,6 +3,8 @@ FILE /extensionLambda.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test1(): Int' CALL 'run(String.() -> Int) on String: Int' type=kotlin.Int origin=null + : String + : Int $receiver: CONST String type=kotlin.String value='42' block: BLOCK type=kotlin.String.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun kotlin.String.(): kotlin.Int diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index b7ff2b08fd9..dcbd8414185 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -23,18 +23,24 @@ FILE /multipleImplicitReceivers.kt FUN public fun test(fooImpl: IFoo, invokeImpl: IInvoke): kotlin.Unit BLOCK_BODY CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null + : A + : Int receiver: GET_OBJECT 'A' type=A block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on A: Int' CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null + : IFoo + : Int receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on IFoo: Int' CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null + : IInvoke + : Int receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.(): kotlin.Int diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt index 686480a60ae..fc8435c468b 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt @@ -2,6 +2,7 @@ FILE /nonLocalReturn.kt FUN public fun test0(): kotlin.Unit BLOCK_BODY CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null + : Nothing block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Nothing BLOCK_BODY @@ -10,6 +11,7 @@ FILE /nonLocalReturn.kt FUN public fun test1(): kotlin.Unit BLOCK_BODY CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null + : Unit block: BLOCK type=() -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Unit BLOCK_BODY @@ -18,6 +20,7 @@ FILE /nonLocalReturn.kt FUN public fun test2(): kotlin.Unit BLOCK_BODY CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null + : Unit block: BLOCK type=() -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.Unit BLOCK_BODY @@ -26,6 +29,7 @@ FILE /nonLocalReturn.kt FUN public fun testLrmFoo1(ints: kotlin.collections.List): kotlin.Unit BLOCK_BODY CALL 'forEach((Int) -> Unit) on Iterable: Unit' type=kotlin.Unit origin=null + : Int $receiver: GET_VAR 'value-parameter ints: List' type=kotlin.collections.List origin=null action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (it: kotlin.Int): kotlin.Unit @@ -42,6 +46,7 @@ FILE /nonLocalReturn.kt FUN public fun testLrmFoo2(ints: kotlin.collections.List): kotlin.Unit BLOCK_BODY CALL 'forEach((Int) -> Unit) on Iterable: Unit' type=kotlin.Unit origin=null + : Int $receiver: GET_VAR 'value-parameter ints: List' type=kotlin.collections.List origin=null action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (it: kotlin.Int): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 9a4c17eb2af..7ccab573575 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -598,6 +598,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { doTest(fileName); } + @TestMetadata("typeArguments.kt") + public void testTypeArguments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/typeArguments.kt"); + doTest(fileName); + } + @TestMetadata("typeOperators.kt") public void testTypeOperators() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/typeOperators.kt");