diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/AbstractClosureAnnotator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/AbstractClosureAnnotator.kt index 9ce81a553ca..4d64e8d174b 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/AbstractClosureAnnotator.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/AbstractClosureAnnotator.kt @@ -31,7 +31,7 @@ import java.util.* class Closure( val capturedThisReferences: List, val capturedReceiverParameters: List, - val capturedVariables: List + val capturedValues: List ) abstract class AbstractClosureAnnotator : IrElementVisitorVoid { @@ -41,18 +41,18 @@ abstract class AbstractClosureAnnotator : IrElementVisitorVoid { private class ClosureBuilder(val owner: DeclarationDescriptor) { val capturedThisReferences = mutableSetOf() val capturedReceiverParameters = mutableSetOf() - val capturedVariables = mutableSetOf() + val capturedValues = mutableSetOf() fun buildClosure() = Closure( capturedThisReferences.toList(), capturedReceiverParameters.toList(), - capturedVariables.toList() + capturedValues.toList() ) fun addNested(closure: Closure) { fillInCapturedThisReferences(closure) fillInNestedClosure(capturedReceiverParameters, closure.capturedReceiverParameters) - fillInNestedClosure(capturedVariables, closure.capturedVariables) + fillInNestedClosure(capturedValues, closure.capturedValues) } private fun fillInCapturedThisReferences(closure: Closure) { @@ -126,25 +126,14 @@ abstract class AbstractClosureAnnotator : IrElementVisitorVoid { declaration.delegate.initializer?.acceptVoid(this) } - override fun visitThisReference(expression: IrThisReference) { - closuresStack.peek().addCapturedThis(expression.classDescriptor) - } - - override fun visitVariableAccess(expression: IrVariableAccessExpression) { + override fun visitVariableAccess(expression: IrValueAccessExpression) { val closureBuilder = closuresStack.peek() val variableDescriptor = expression.descriptor if (variableDescriptor.containingDeclaration != closureBuilder.owner) { - closureBuilder.capturedVariables.add(variableDescriptor) + closureBuilder.capturedValues.add(variableDescriptor) } expression.acceptChildrenVoid(this) } - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver) { - val closureBuilder = closuresStack.peek() - val receiverDescriptor = expression.descriptor - if (receiverDescriptor.containingDeclaration != closureBuilder.owner) { - closureBuilder.capturedReceiverParameters.add(receiverDescriptor) - } - } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 7818786f3de..bed3647ed12 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -238,11 +238,7 @@ class ExpressionCodegen( return expression.accept(this, data) } - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: BlockInfo): StackValue { - return generateLocal(expression.descriptor, expression.asmType) - } - - override fun visitGetVariable(expression: IrGetVariable, data: BlockInfo): StackValue { + override fun visitGetValue(expression: IrGetValue, data: BlockInfo): StackValue { return generateLocal(expression.descriptor, expression.asmType) } @@ -286,11 +282,6 @@ class ExpressionCodegen( return expression.onStack } - override fun visitThisReference(expression: IrThisReference, data: BlockInfo): StackValue { - StackValue.local(0, expression.asmType).put(expression.asmType, mv) - return expression.onStack - } - override fun visitConst(expression: IrConst, data: BlockInfo): StackValue { val value = expression.value val type = expression.asmType diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index b4982ed3553..2e364554e30 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -19,11 +19,17 @@ package org.jetbrains.kotlin.backend.jvm.codegen import org.jetbrains.kotlin.backend.jvm.lower.InitializersLowering import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.AsmUtil.isStaticMethod -import org.jetbrains.kotlin.codegen.FunctionCodegen.createFrameMap +import org.jetbrains.kotlin.codegen.FrameMap import org.jetbrains.kotlin.codegen.JvmCodegenUtil import org.jetbrains.kotlin.codegen.OwnerKind +import org.jetbrains.kotlin.codegen.state.GenerationState +import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor +import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.jvm.AsmTypes +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind +import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature import org.jetbrains.org.objectweb.asm.Opcodes import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter @@ -36,7 +42,7 @@ class FunctionCodegen(val irFunction: IrFunction, val classCodegen: ClassCodegen fun generate() { val signature = classCodegen.typeMapper.mapSignatureWithGeneric(descriptor, OwnerKind.IMPLEMENTATION) val isStatic = isStaticMethod(classCodegen.descriptor.getMemberOwnerKind(), descriptor) || DescriptorUtils.isStaticDeclaration(descriptor) - val frameMap = createFrameMap(classCodegen.state, descriptor, signature, isStatic) + val frameMap = createFrameMapWithReceivers(classCodegen.state, descriptor, signature, isStatic) var flags = AsmUtil.getMethodAsmFlags(descriptor, OwnerKind.IMPLEMENTATION, state).or(if (isStatic) Opcodes.ACC_STATIC else 0) val interfaceClInit = JvmCodegenUtil.isJvmInterface(classCodegen.descriptor) && InitializersLowering.clinitName == descriptor.name @@ -57,3 +63,42 @@ class FunctionCodegen(val irFunction: IrFunction, val classCodegen: ClassCodegen ExpressionCodegen(irFunction, frameMap, InstructionAdapter(methodVisitor), classCodegen).generate() } } + +fun createFrameMapWithReceivers( + state: GenerationState, + function: FunctionDescriptor, + signature: JvmMethodSignature, + isStatic: Boolean +): FrameMap { + val frameMap = FrameMap() + if (!isStatic) { + val descriptorForThis = + if (function is ClassConstructorDescriptor) + function.containingDeclaration.thisAsReceiverParameter + else + function.dispatchReceiverParameter + + frameMap.enter(descriptorForThis, AsmTypes.OBJECT_TYPE) + } + + for (parameter in signature.valueParameters) { + if (parameter.kind == JvmMethodParameterKind.RECEIVER) { + val receiverParameter = function.extensionReceiverParameter + if (receiverParameter != null) { + frameMap.enter(receiverParameter, state.typeMapper.mapType(receiverParameter)) + } + else { + frameMap.enterTemp(parameter.asmType) + } + } + else if (parameter.kind != JvmMethodParameterKind.VALUE) { + frameMap.enterTemp(parameter.asmType) + } + } + + for (parameter in function.valueParameters) { + frameMap.enter(parameter, state.typeMapper.mapType(parameter)) + } + + return frameMap +} \ No newline at end of file diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt index c6d7f88c565..2c374496ea5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt @@ -282,8 +282,8 @@ class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringPass { throw AssertionError("No 'ordinal' parameter in enum constructor: $enumClassConstructor") } - result.putValueArgument(0, IrGetVariableImpl(startOffset, endOffset, nameParameter, origin)) - result.putValueArgument(1, IrGetVariableImpl(startOffset, endOffset, ordinalParameter, origin)) + result.putValueArgument(0, IrGetValueImpl(startOffset, endOffset, nameParameter, origin)) + result.putValueArgument(1, IrGetValueImpl(startOffset, endOffset, ordinalParameter, origin)) return result } @@ -299,8 +299,8 @@ class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringPass { val result = IrDelegatingConstructorCallImpl(startOffset, endOffset, loweredDelegatedConstructor) - result.putValueArgument(0, IrGetVariableImpl(startOffset, endOffset, enumClassConstructor.valueParameters[0])) - result.putValueArgument(1, IrGetVariableImpl(startOffset, endOffset, enumClassConstructor.valueParameters[1])) + result.putValueArgument(0, IrGetValueImpl(startOffset, endOffset, enumClassConstructor.valueParameters[0])) + result.putValueArgument(1, IrGetValueImpl(startOffset, endOffset, enumClassConstructor.valueParameters[1])) descriptor.valueParameters.forEach { valueParameter -> val i = valueParameter.index @@ -422,10 +422,10 @@ class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringPass { return expression } - override fun visitGetVariable(expression: IrGetVariable): IrExpression { + override fun visitGetValue(expression: IrGetValue): IrExpression { val loweredParameter = loweredEnumConstructorParameters[expression.descriptor] if (loweredParameter != null) { - return IrGetVariableImpl(expression.startOffset, expression.endOffset, loweredParameter, expression.origin) + return IrGetValueImpl(expression.startOffset, expression.endOffset, loweredParameter, expression.origin) } else { return expression @@ -452,7 +452,7 @@ class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringPass { val irValueOfCall = IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, substitutedValueOf, mapOf(typeParameterT to enumClassType)) irValueOfCall.putValueArgument( - 0, IrGetVariableImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueOfFunctionDescriptor.valueParameters[0])) + 0, IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueOfFunctionDescriptor.valueParameters[0])) return IrBlockBodyImpl( UNDEFINED_OFFSET, UNDEFINED_OFFSET, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InitializersLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InitializersLowering.kt index af32df7f93b..01ff8ca9b1e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InitializersLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InitializersLowering.kt @@ -19,24 +19,25 @@ package org.jetbrains.kotlin.backend.jvm.lower import org.jetbrains.kotlin.backend.jvm.ClassLoweringPass import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin -import org.jetbrains.kotlin.backend.jvm.codegen.getMemberOwnerKind -import org.jetbrains.kotlin.codegen.AsmUtil -import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.SourceElement +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrField import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl -import org.jetbrains.kotlin.ir.expressions.IrBlockBody import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrInstanceInitializerCall import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrThisReferenceImpl import org.jetbrains.kotlin.ir.util.DeepCopyIrTree -import org.jetbrains.kotlin.ir.util.dump import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid @@ -71,8 +72,8 @@ class InitializersLowering(val context: JvmBackendContext) : ClassLoweringPass { val receiver = if (declaration.descriptor.dispatchReceiverParameter != null) // TODO isStaticField - IrThisReferenceImpl(irFieldInitializer.startOffset, irFieldInitializer.endOffset, - irClass.descriptor.defaultType, irClass.descriptor) + IrGetValueImpl(irFieldInitializer.startOffset, irFieldInitializer.endOffset, + irClass.descriptor.thisAsReceiverParameter) else null val irSetField = IrSetFieldImpl( irFieldInitializer.startOffset, irFieldInitializer.endOffset, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceDelegationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceDelegationLowering.kt index 30d4ad4947f..50236a71931 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceDelegationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceDelegationLowering.kt @@ -79,11 +79,11 @@ class InterfaceDelegationLowering(val state: GenerationState) : IrElementTransfo var shift = 0 if (inheritedFun.dispatchReceiverParameter != null) { - irCallImpl.putValueArgument(0, IrThisReferenceImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irClass.descriptor.defaultType, irClass.descriptor)) + irCallImpl.putValueArgument(0, IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irClass.descriptor.thisAsReceiverParameter)) shift = 1 } inheritedFun.valueParameters.mapIndexed { i, valueParameterDescriptor -> - irCallImpl.putValueArgument(i + shift, IrGetVariableImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueParameterDescriptor, null)) + irCallImpl.putValueArgument(i + shift, IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueParameterDescriptor, null)) } } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt index 3a651b905e2..78f729c7fd2 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt @@ -31,8 +31,8 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrGetVariable -import org.jetbrains.kotlin.ir.expressions.impl.IrGetVariableImpl +import org.jetbrains.kotlin.ir.expressions.IrGetValue +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.ir.util.transform import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid @@ -76,8 +76,8 @@ class InterfaceLowering(val state: GenerationState) : IrElementTransformerVoid() irClass.transformChildrenVoid(this) } - override fun visitGetVariable(expression: IrGetVariable): IrExpression { - return super.visitGetVariable(expression) + override fun visitGetValue(expression: IrGetValue): IrExpression { + return super.visitGetValue(expression) } companion object { @@ -118,8 +118,8 @@ class InterfaceLowering(val state: GenerationState) : IrElementTransformerVoid() class VariableRemapper(val mapping: Map): IrElementTransformerVoid() { - override fun visitGetVariable(expression: IrGetVariable): IrExpression = + override fun visitGetValue(expression: IrGetValue): IrExpression = mapping[expression.descriptor]?.let { loweredParameter -> - IrGetVariableImpl(expression.startOffset, expression.endOffset, loweredParameter, expression.origin) + IrGetValueImpl(expression.startOffset, expression.endOffset, loweredParameter, expression.origin) } ?: expression } \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/IrUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/IrUtils.kt index 53fa42e7131..ba54d14ed01 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/IrUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/IrUtils.kt @@ -19,7 +19,7 @@ package org.jetbrains.kotlin.psi2ir import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrGetVariableImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.psi2ir.containsNull import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.checker.KotlinTypeChecker @@ -28,5 +28,5 @@ import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.upperIfFlexible fun IrVariable.defaultLoad(): IrExpression = - IrGetVariableImpl(startOffset, endOffset, descriptor) + IrGetValueImpl(startOffset, endOffset, descriptor) 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 d141f0399f7..6c0da7c75ff 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 @@ -74,11 +74,11 @@ fun IrBuilderWithScope.irIfThenReturnFalse(condition: IrExpression) = fun IrBuilderWithScope.irThis() = scope.classOwner().let { classOwner -> - IrThisReferenceImpl(startOffset, endOffset, classOwner.defaultType, classOwner) + IrGetValueImpl(startOffset, endOffset, classOwner.thisAsReceiverParameter) } fun IrBuilderWithScope.irGet(variable: VariableDescriptor) = - IrGetVariableImpl(startOffset, endOffset, variable) + IrGetValueImpl(startOffset, endOffset, variable) fun IrBuilderWithScope.irSetVar(variable: VariableDescriptor, value: IrExpression) = IrSetVariableImpl(startOffset, endOffset, variable, value, IrStatementOrigin.EQ) 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 aec93fb7fc1..a2f2a87bfcc 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 @@ -43,7 +43,7 @@ fun StatementGenerator.generateReceiver(ktDefaultElement: KtElement, receiver: R val receiverExpression = when (receiver) { is ImplicitClassReceiver -> - IrThisReferenceImpl(ktDefaultElement.startOffset, ktDefaultElement.startOffset, receiver.type, receiver.classDescriptor) + IrGetValueImpl(ktDefaultElement.startOffset, ktDefaultElement.startOffset, receiver.classDescriptor.thisAsReceiverParameter) is ThisClassReceiver -> generateThisOrSuperReceiver(receiver, receiver.classDescriptor) is SuperCallReceiverValue -> @@ -54,8 +54,8 @@ fun StatementGenerator.generateReceiver(ktDefaultElement: KtElement, receiver: R IrGetObjectValueImpl(receiver.expression.startOffset, receiver.expression.endOffset, receiver.type, receiver.classQualifier.descriptor) is ExtensionReceiver -> - IrGetExtensionReceiverImpl(ktDefaultElement.startOffset, ktDefaultElement.startOffset, - receiver.declarationDescriptor.extensionReceiverParameter!!) + IrGetValueImpl(ktDefaultElement.startOffset, ktDefaultElement.startOffset, + receiver.declarationDescriptor.extensionReceiverParameter!!) else -> TODO("Receiver: ${receiver.javaClass.simpleName}") } @@ -70,7 +70,7 @@ private fun generateThisOrSuperReceiver(receiver: ReceiverValue, classDescriptor val expressionReceiver = receiver as? ExpressionReceiver ?: throw AssertionError("'this' or 'super' receiver should be an expression receiver") val ktReceiver = expressionReceiver.expression - return IrThisReferenceImpl(ktReceiver.startOffset, ktReceiver.endOffset, receiver.type, classDescriptor) + return IrGetValueImpl(ktReceiver.startOffset, ktReceiver.endOffset, classDescriptor.thisAsReceiverParameter) } fun StatementGenerator.generateCallReceiver( 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 74785f9f49a..47f1856c28f 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 @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.impl.IrThisReferenceImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset @@ -139,7 +139,7 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen ): AssignmentReceiver { if (isValInitializationInConstructor(descriptor, resolvedCall)) { val thisClass = getThisClass() - val irThis = IrThisReferenceImpl(ktLeft.startOffset, ktLeft.endOffset, thisClass.defaultType, thisClass) + val irThis = IrGetValueImpl(ktLeft.startOffset, ktLeft.endOffset, thisClass.thisAsReceiverParameter) return BackingFieldLValue(ktLeft.startOffset, ktLeft.endOffset, descriptor, RematerializableValue(irThis), null) } 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 f05908113cb..7c7dad2e26f 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 @@ -54,7 +54,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE if (descriptor is LocalVariableDescriptor && descriptor.isDelegated) IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, typeArguments, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY) else - IrGetVariableImpl(startOffset, endOffset, descriptor, origin) + IrGetValueImpl(startOffset, endOffset, descriptor, origin) fun generateDelegatingConstructorCall(startOffset: Int, endOffset: Int, call: CallBuilder) : IrExpression { val descriptor = call.descriptor 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 c11f8b03dfa..d946f3ae211 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 @@ -18,15 +18,19 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrEnumEntry import org.jetbrains.kotlin.ir.declarations.impl.* import org.jetbrains.kotlin.ir.descriptors.IrImplementingDelegateDescriptorImpl -import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl +import org.jetbrains.kotlin.ir.expressions.mapValueParameters import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtDelegatedSuperTypeEntry import org.jetbrains.kotlin.psi.KtEnumEntry -import org.jetbrains.kotlin.psi.KtParameter import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.renderer.ClassifierNamePolicy @@ -164,13 +168,13 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator val irBlockBody = IrBlockBodyImpl(irDelegate.startOffset, irDelegate.endOffset) val returnType = overridden.returnType!! val irCall = IrCallImpl(irDelegate.startOffset, irDelegate.endOffset, returnType, overridden, null) - irCall.dispatchReceiver = IrGetVariableImpl(irDelegate.startOffset, irDelegate.endOffset, irDelegate.descriptor) + irCall.dispatchReceiver = IrGetValueImpl(irDelegate.startOffset, irDelegate.endOffset, irDelegate.descriptor) irCall.extensionReceiver = delegated.extensionReceiverParameter?.let { extensionReceiver -> - IrGetExtensionReceiverImpl(irDelegate.startOffset, irDelegate.endOffset, extensionReceiver) + IrGetValueImpl(irDelegate.startOffset, irDelegate.endOffset, extensionReceiver) } irCall.mapValueParameters { overriddenValueParameter -> val delegatedValueParameter = delegated.valueParameters[overriddenValueParameter.index] - IrGetVariableImpl(irDelegate.startOffset, irDelegate.endOffset, delegatedValueParameter) + IrGetValueImpl(irDelegate.startOffset, irDelegate.endOffset, delegatedValueParameter) } if (KotlinBuiltIns.isUnit(returnType) || KotlinBuiltIns.isNothing(returnType)) { irBlockBody.statements.add(irCall) 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 37006257950..be62c0b90a1 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 @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.ir.descriptors.IrPropertyDelegateDescriptor import org.jetbrains.kotlin.ir.descriptors.IrPropertyDelegateDescriptorImpl import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrCallableReferenceImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrThisReferenceImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyDelegate @@ -82,7 +82,7 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener private fun createBackingFieldValueForDelegate(delegateDescriptor: IrPropertyDelegateDescriptor, ktDelegate: KtPropertyDelegate): IntermediateValue { val thisClass = delegateDescriptor.correspondingProperty.containingDeclaration as? ClassDescriptor val thisValue = thisClass?.let { - RematerializableValue(IrThisReferenceImpl(ktDelegate.startOffset, ktDelegate.endOffset, thisClass.defaultType, thisClass)) + RematerializableValue(IrGetValueImpl(ktDelegate.startOffset, ktDelegate.endOffset, thisClass.thisAsReceiverParameter)) } return BackingFieldLValue(ktDelegate.startOffset, ktDelegate.endOffset, delegateDescriptor, thisValue, null) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt index f3bd12a908c..a96f1dafbbf 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl import org.jetbrains.kotlin.ir.expressions.IrBlockBody +import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.psi.KtElement @@ -37,7 +38,6 @@ import org.jetbrains.kotlin.psi.KtPropertyDelegate import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.DescriptorUtils class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Generator { override val context: GeneratorContext get() = declarationGenerator.context @@ -58,8 +58,8 @@ class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Genera val irProperty = IrPropertyImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.DEFINED, false, propertyDescriptor) val irField = IrFieldImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, propertyDescriptor) - val irGetParameter = IrGetVariableImpl(ktParameter.startOffset, ktParameter.endOffset, - valueParameterDescriptor, IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER) + val irGetParameter = IrGetValueImpl(ktParameter.startOffset, ktParameter.endOffset, + valueParameterDescriptor, IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER) irField.initializer = IrExpressionBodyImpl(ktParameter.startOffset, ktParameter.endOffset, irGetParameter) irProperty.backingField = irField @@ -160,16 +160,15 @@ class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Genera val setterParameter = setter.valueParameters.single() irBody.statements.add(IrSetFieldImpl(ktProperty.startOffset, ktProperty.endOffset, property, receiver, - IrGetVariableImpl(ktProperty.startOffset, ktProperty.endOffset, setterParameter))) + IrGetValueImpl(ktProperty.startOffset, ktProperty.endOffset, setterParameter))) return irBody } - private fun generateReceiverExpressionForDefaultPropertyAccessor(ktProperty: KtElement, property: PropertyDescriptor): IrThisReferenceImpl? { + private fun generateReceiverExpressionForDefaultPropertyAccessor(ktProperty: KtElement, property: PropertyDescriptor): IrExpression? { val containingDeclaration = property.containingDeclaration val receiver = if (containingDeclaration is ClassDescriptor) - IrThisReferenceImpl(ktProperty.startOffset, ktProperty.endOffset, containingDeclaration.defaultType, - containingDeclaration) + IrGetValueImpl(ktProperty.startOffset, ktProperty.endOffset, containingDeclaration.thisAsReceiverParameter) else null return receiver 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 592378b6982..5872b15fcda 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 @@ -316,14 +316,10 @@ class StatementGenerator( val referenceTarget = getOrFail(BindingContext.REFERENCE_TARGET, expression.instanceReference) { "No reference target for this" } return when (referenceTarget) { is ClassDescriptor -> - IrThisReferenceImpl( - expression.startOffset, expression.endOffset, - referenceTarget.defaultType, // TODO substituted type for 'this'? - referenceTarget - ) + IrGetValueImpl(expression.startOffset, expression.endOffset, referenceTarget.thisAsReceiverParameter) is CallableDescriptor -> { val extensionReceiver = referenceTarget.extensionReceiverParameter ?: TODO("No extension receiver: $referenceTarget") - IrGetExtensionReceiverImpl(expression.startOffset, expression.endOffset, extensionReceiver) + IrGetValueImpl(expression.startOffset, expression.endOffset, extensionReceiver) } else -> error("Expected this or receiver: $referenceTarget") diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt index 45b4b429db3..3a5e2dc38fb 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.VariableDescriptor import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.impl.IrGetVariableImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSetVariableImpl import org.jetbrains.kotlin.types.KotlinType @@ -36,7 +36,7 @@ class VariableLValue( override val type: KotlinType get() = descriptor.type override fun load(): IrExpression = - IrGetVariableImpl(startOffset, endOffset, descriptor, origin) + IrGetValueImpl(startOffset, endOffset, descriptor, origin) override fun store(irExpression: IrExpression): IrExpression = IrSetVariableImpl(startOffset, endOffset, descriptor, irExpression, origin) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrGetExtensionReceiver.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrGetExtensionReceiver.kt deleted file mode 100644 index a5c2eadd901..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrGetExtensionReceiver.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.ir.expressions - -import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor - -interface IrGetExtensionReceiver : IrDeclarationReference, IrExpressionWithCopy { - override val descriptor: ReceiverParameterDescriptor - - override fun copy(): IrGetExtensionReceiver -} - diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrThisReference.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrThisReference.kt deleted file mode 100644 index 56cf09fa0de..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrThisReference.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.ir.expressions - -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor - -interface IrThisReference : IrExpression, IrExpressionWithCopy { - val classDescriptor: ClassDescriptor - override fun copy(): IrThisReference -} - -val IrThisReference.receiverParameter: ReceiverParameterDescriptor - get() = classDescriptor.thisAsReceiverParameter - diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrVariableAccessExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrValueAccessExpression.kt similarity index 72% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrVariableAccessExpression.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrValueAccessExpression.kt index 692899003c9..8bc60e947af 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrVariableAccessExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrValueAccessExpression.kt @@ -16,18 +16,20 @@ package org.jetbrains.kotlin.ir.expressions +import org.jetbrains.kotlin.descriptors.ValueDescriptor import org.jetbrains.kotlin.descriptors.VariableDescriptor -interface IrVariableAccessExpression : IrDeclarationReference { - override val descriptor: VariableDescriptor +interface IrValueAccessExpression : IrDeclarationReference { + override val descriptor: ValueDescriptor val origin: IrStatementOrigin? } -interface IrGetVariable : IrVariableAccessExpression, IrExpressionWithCopy { - override fun copy(): IrGetVariable +interface IrGetValue : IrValueAccessExpression, IrExpressionWithCopy { + override fun copy(): IrGetValue } -interface IrSetVariable : IrVariableAccessExpression { +interface IrSetVariable : IrValueAccessExpression { + override val descriptor: VariableDescriptor var value: IrExpression } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetExtensionReceiverImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetExtensionReceiverImpl.kt deleted file mode 100644 index cea93b2637c..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetExtensionReceiverImpl.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.ir.expressions.impl - -import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor -import org.jetbrains.kotlin.ir.expressions.IrGetExtensionReceiver -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor - -class IrGetExtensionReceiverImpl( - startOffset: Int, - endOffset: Int, - descriptor: ReceiverParameterDescriptor -) : IrTerminalDeclarationReferenceBase(startOffset, endOffset, descriptor.type, descriptor), IrGetExtensionReceiver { - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitGetExtensionReceiver(this, data) - - override fun copy(): IrGetExtensionReceiver = - IrGetExtensionReceiverImpl(startOffset, endOffset, descriptor) -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetVariableImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt similarity index 60% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetVariableImpl.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt index ead91e86965..27b4421fff9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetVariableImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt @@ -16,19 +16,18 @@ package org.jetbrains.kotlin.ir.expressions.impl -import org.jetbrains.kotlin.descriptors.VariableDescriptor -import org.jetbrains.kotlin.ir.expressions.IrGetVariable +import org.jetbrains.kotlin.descriptors.ValueDescriptor +import org.jetbrains.kotlin.ir.expressions.IrGetValue import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.impl.IrTerminalDeclarationReferenceBase import org.jetbrains.kotlin.ir.visitors.IrElementVisitor -class IrGetVariableImpl( - startOffset: Int, endOffset: Int, descriptor: VariableDescriptor, +class IrGetValueImpl( + startOffset: Int, endOffset: Int, descriptor: ValueDescriptor, override val origin: IrStatementOrigin? = null -) : IrTerminalDeclarationReferenceBase(startOffset, endOffset, descriptor.type, descriptor), IrGetVariable { +) : IrTerminalDeclarationReferenceBase(startOffset, endOffset, descriptor.type, descriptor), IrGetValue { override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitGetVariable(this, data) + visitor.visitGetValue(this, data) - override fun copy(): IrGetVariable = - IrGetVariableImpl(startOffset, endOffset, descriptor, origin) + override fun copy(): IrGetValue = + IrGetValueImpl(startOffset, endOffset, descriptor, origin) } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThisReferenceImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThisReferenceImpl.kt deleted file mode 100644 index 748a630e3b2..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThisReferenceImpl.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.ir.expressions.impl - -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.ir.expressions.IrThisReference -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor -import org.jetbrains.kotlin.types.KotlinType - -class IrThisReferenceImpl( - startOffset: Int, - endOffset: Int, - type: KotlinType, - override val classDescriptor: ClassDescriptor -) : IrTerminalExpressionBase(startOffset, endOffset, type), IrThisReference { - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitThisReference(this, data) - - override fun copy(): IrThisReference = - IrThisReferenceImpl(startOffset, endOffset, type, classDescriptor) -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt index ba35511b0d8..36773770591 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt @@ -48,6 +48,7 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { protected open fun mapSuperQualifier(qualifier: ClassDescriptor?) = qualifier protected open fun mapClassReference(descriptor: ClassDescriptor) = descriptor + protected open fun mapValueReference(descriptor: ValueDescriptor) = descriptor protected open fun mapVariableReference(descriptor: VariableDescriptor) = descriptor protected open fun mapPropertyReference(descriptor: PropertyDescriptor) = descriptor protected open fun mapReceiverParameterReference(descriptor: ReceiverParameterDescriptor) = descriptor @@ -234,13 +235,6 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { expression.arguments.map { it.transform(this, null) } ) - override fun visitThisReference(expression: IrThisReference): IrThisReference = - IrThisReferenceImpl( - expression.startOffset, expression.endOffset, - expression.type, - mapClassReference(expression.classDescriptor) - ) - override fun visitGetObjectValue(expression: IrGetObjectValue): IrGetObjectValue = IrGetObjectValueImpl( expression.startOffset, expression.endOffset, @@ -255,10 +249,10 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { mapClassReference(expression.descriptor) ) - override fun visitGetVariable(expression: IrGetVariable): IrGetVariable = - IrGetVariableImpl( + override fun visitGetValue(expression: IrGetValue): IrGetValue = + IrGetValueImpl( expression.startOffset, expression.endOffset, - mapVariableReference(expression.descriptor), + mapValueReference(expression.descriptor), mapStatementOrigin(expression.origin) ) @@ -289,12 +283,6 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { mapSuperQualifier(expression.superQualifier) ) - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver): IrGetExtensionReceiver = - IrGetExtensionReceiverImpl( - expression.startOffset, expression.endOffset, - mapReceiverParameterReference(expression.descriptor) - ) - override fun visitCall(expression: IrCall): IrCall = shallowCopyCall(expression).transformValueArguments(expression) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt index 4e280846fb6..13362a30566 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.ir.util import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* @@ -102,12 +103,6 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitReturn(expression: IrReturn, data: Nothing?): String = "RETURN type=${expression.type.render()} from='${expression.returnTarget.ref()}'" - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: Nothing?): String = - "\$RECEIVER of '${expression.descriptor.containingDeclaration.ref()}' type=${expression.type.render()}" - - override fun visitThisReference(expression: IrThisReference, data: Nothing?): String = - "THIS of '${expression.classDescriptor.ref()}' type=${expression.type.render()}" - override fun visitCall(expression: IrCall, data: Nothing?): String = "CALL '${expression.descriptor.ref()}' ${expression.renderSuperQualifier()}" + "type=${expression.type.render()} origin=${expression.origin}" @@ -124,7 +119,7 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: Nothing?): String = "INSTANCE_INITIALIZER_CALL classDescriptor='${expression.classDescriptor.ref()}'" - override fun visitGetVariable(expression: IrGetVariable, data: Nothing?): String = + override fun visitGetValue(expression: IrGetValue, data: Nothing?): String = "GET_VAR '${expression.descriptor.ref()}' type=${expression.type.render()} origin=${expression.origin}" override fun visitSetVariable(expression: IrSetVariable, data: Nothing?): String = @@ -212,7 +207,10 @@ class RenderIrElementVisitor : IrElementVisitor { DECLARATION_RENDERER.render(this.descriptor) internal fun DeclarationDescriptor.ref(): String = - REFERENCE_RENDERER.render(this) + if (this is ReceiverParameterDescriptor) + "" + else + REFERENCE_RENDERER.render(this) internal fun KotlinType.render(): String = DECLARATION_RENDERER.renderType(this) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt index f85242044d5..8836c8e12df 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt @@ -65,19 +65,17 @@ interface IrElementTransformer : IrElementVisitor { override fun visitBlock(expression: IrBlock, data: D) = visitContainerExpression(expression, data) override fun visitComposite(expression: IrComposite, data: D) = visitContainerExpression(expression, data) override fun visitStringConcatenation(expression: IrStringConcatenation, data: D) = visitExpression(expression, data) - override fun visitThisReference(expression: IrThisReference, data: D) = visitExpression(expression, data) override fun visitDeclarationReference(expression: IrDeclarationReference, data: D) = visitExpression(expression, data) override fun visitSingletonReference(expression: IrGetSingletonValue, data: D) = visitDeclarationReference(expression, data) override fun visitGetObjectValue(expression: IrGetObjectValue, data: D) = visitSingletonReference(expression, data) override fun visitGetEnumValue(expression: IrGetEnumValue, data: D) = visitSingletonReference(expression, data) - override fun visitVariableAccess(expression: IrVariableAccessExpression, data: D) = visitDeclarationReference(expression, data) - override fun visitGetVariable(expression: IrGetVariable, data: D) = visitVariableAccess(expression, data) - override fun visitSetVariable(expression: IrSetVariable, data: D) = visitVariableAccess(expression, data) + override fun visitValueAccess(expression: IrValueAccessExpression, data: D) = visitDeclarationReference(expression, data) + override fun visitGetValue(expression: IrGetValue, data: D) = visitValueAccess(expression, data) + override fun visitSetVariable(expression: IrSetVariable, data: D) = visitValueAccess(expression, data) override fun visitFieldAccess(expression: IrFieldAccessExpression, data: D) = visitDeclarationReference(expression, data) override fun visitGetField(expression: IrGetField, data: D) = visitFieldAccess(expression, data) override fun visitSetField(expression: IrSetField, data: D) = visitFieldAccess(expression, data) - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: D) = visitDeclarationReference(expression, data) override fun visitMemberAccess(expression: IrMemberAccessExpression, data: D): IrElement = visitDeclarationReference(expression, data) override fun visitCall(expression: IrCall, data: D) = visitMemberAccess(expression, data) override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: D) = visitMemberAccess(expression, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt index d859ffdbdcd..5db7fd42bb6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt @@ -101,9 +101,6 @@ abstract class IrElementTransformerVoid : IrElementTransformer { open fun visitStringConcatenation(expression: IrStringConcatenation) = visitExpression(expression) override final fun visitStringConcatenation(expression: IrStringConcatenation, data: Nothing?) = visitStringConcatenation(expression) - open fun visitThisReference(expression: IrThisReference) = visitExpression(expression) - override final fun visitThisReference(expression: IrThisReference, data: Nothing?) = visitThisReference(expression) - open fun visitDeclarationReference(expression: IrDeclarationReference) = visitExpression(expression) override final fun visitDeclarationReference(expression: IrDeclarationReference, data: Nothing?) = visitDeclarationReference(expression) @@ -116,13 +113,13 @@ abstract class IrElementTransformerVoid : IrElementTransformer { open fun visitGetEnumValue(expression: IrGetEnumValue) = visitSingletonReference(expression) override final fun visitGetEnumValue(expression: IrGetEnumValue, data: Nothing?) = visitGetEnumValue(expression) - open fun visitVariableAccess(expression: IrVariableAccessExpression) = visitDeclarationReference(expression) - override final fun visitVariableAccess(expression: IrVariableAccessExpression, data: Nothing?) = visitVariableAccess(expression) + open fun visitValueAccess(expression: IrValueAccessExpression) = visitDeclarationReference(expression) + override final fun visitValueAccess(expression: IrValueAccessExpression, data: Nothing?) = visitValueAccess(expression) - open fun visitGetVariable(expression: IrGetVariable) = visitVariableAccess(expression) - override final fun visitGetVariable(expression: IrGetVariable, data: Nothing?) = visitGetVariable(expression) + open fun visitGetValue(expression: IrGetValue) = visitValueAccess(expression) + override final fun visitGetValue(expression: IrGetValue, data: Nothing?) = visitGetValue(expression) - open fun visitSetVariable(expression: IrSetVariable) = visitVariableAccess(expression) + open fun visitSetVariable(expression: IrSetVariable) = visitValueAccess(expression) override final fun visitSetVariable(expression: IrSetVariable, data: Nothing?) = visitSetVariable(expression) open fun visitFieldAccess(expression: IrFieldAccessExpression) = visitDeclarationReference(expression) @@ -134,9 +131,6 @@ abstract class IrElementTransformerVoid : IrElementTransformer { open fun visitSetField(expression: IrSetField) = visitFieldAccess(expression) override final fun visitSetField(expression: IrSetField, data: Nothing?) = visitSetField(expression) - open fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver) = visitDeclarationReference(expression) - override final fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: Nothing?) = visitGetExtensionReceiver(expression) - open fun visitMemberAccess(expression: IrMemberAccessExpression) = visitDeclarationReference(expression) override final fun visitMemberAccess(expression: IrMemberAccessExpression, data: Nothing?) = visitMemberAccess(expression) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt index dddde726575..1bdc90df358 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt @@ -51,19 +51,17 @@ interface IrElementVisitor { fun visitBlock(expression: IrBlock, data: D) = visitContainerExpression(expression, data) fun visitComposite(expression: IrComposite, data: D) = visitContainerExpression(expression, data) fun visitStringConcatenation(expression: IrStringConcatenation, data: D) = visitExpression(expression, data) - fun visitThisReference(expression: IrThisReference, data: D) = visitExpression(expression, data) fun visitDeclarationReference(expression: IrDeclarationReference, data: D) = visitExpression(expression, data) fun visitSingletonReference(expression: IrGetSingletonValue, data: D) = visitDeclarationReference(expression, data) fun visitGetObjectValue(expression: IrGetObjectValue, data: D) = visitSingletonReference(expression, data) fun visitGetEnumValue(expression: IrGetEnumValue, data: D) = visitSingletonReference(expression, data) - fun visitVariableAccess(expression: IrVariableAccessExpression, data: D) = visitDeclarationReference(expression, data) - fun visitGetVariable(expression: IrGetVariable, data: D) = visitVariableAccess(expression, data) - fun visitSetVariable(expression: IrSetVariable, data: D) = visitVariableAccess(expression, data) + fun visitValueAccess(expression: IrValueAccessExpression, data: D) = visitDeclarationReference(expression, data) + fun visitGetValue(expression: IrGetValue, data: D) = visitValueAccess(expression, data) + fun visitSetVariable(expression: IrSetVariable, data: D) = visitValueAccess(expression, data) fun visitFieldAccess(expression: IrFieldAccessExpression, data: D) = visitDeclarationReference(expression, data) fun visitGetField(expression: IrGetField, data: D) = visitFieldAccess(expression, data) fun visitSetField(expression: IrSetField, data: D) = visitFieldAccess(expression, data) - fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: D) = visitDeclarationReference(expression, data) fun visitMemberAccess(expression: IrMemberAccessExpression, data: D) = visitDeclarationReference(expression, data) fun visitCall(expression: IrCall, data: D) = visitMemberAccess(expression, data) fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: D) = visitMemberAccess(expression, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt index 067be3ca8a3..555e493bbea 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt @@ -99,9 +99,6 @@ interface IrElementVisitorVoid : IrElementVisitor { fun visitStringConcatenation(expression: IrStringConcatenation) = visitExpression(expression) override fun visitStringConcatenation(expression: IrStringConcatenation, data: Nothing?) = visitStringConcatenation(expression) - fun visitThisReference(expression: IrThisReference) = visitExpression(expression) - override fun visitThisReference(expression: IrThisReference, data: Nothing?) = visitThisReference(expression) - fun visitDeclarationReference(expression: IrDeclarationReference) = visitExpression(expression) override fun visitDeclarationReference(expression: IrDeclarationReference, data: Nothing?) = visitDeclarationReference(expression) @@ -114,11 +111,11 @@ interface IrElementVisitorVoid : IrElementVisitor { fun visitGetEnumValue(expression: IrGetEnumValue) = visitSingletonReference(expression) override fun visitGetEnumValue(expression: IrGetEnumValue, data: Nothing?) = visitGetEnumValue(expression) - fun visitVariableAccess(expression: IrVariableAccessExpression) = visitDeclarationReference(expression) - override fun visitVariableAccess(expression: IrVariableAccessExpression, data: Nothing?) = visitVariableAccess(expression) + fun visitVariableAccess(expression: IrValueAccessExpression) = visitDeclarationReference(expression) + override fun visitValueAccess(expression: IrValueAccessExpression, data: Nothing?) = visitVariableAccess(expression) - fun visitGetVariable(expression: IrGetVariable) = visitVariableAccess(expression) - override fun visitGetVariable(expression: IrGetVariable, data: Nothing?) = visitGetVariable(expression) + fun visitGetVariable(expression: IrGetValue) = visitVariableAccess(expression) + override fun visitGetValue(expression: IrGetValue, data: Nothing?) = visitGetVariable(expression) fun visitSetVariable(expression: IrSetVariable) = visitVariableAccess(expression) override fun visitSetVariable(expression: IrSetVariable, data: Nothing?) = visitSetVariable(expression) @@ -132,9 +129,6 @@ interface IrElementVisitorVoid : IrElementVisitor { fun visitSetField(expression: IrSetField) = visitFieldAccess(expression) override fun visitSetField(expression: IrSetField, data: Nothing?) = visitSetField(expression) - fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver) = visitDeclarationReference(expression) - override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: Nothing?) = visitGetExtensionReceiver(expression) - fun visitMemberAccess(expression: IrMemberAccessExpression) = visitDeclarationReference(expression) override fun visitMemberAccess(expression: IrMemberAccessExpression, data: Nothing?) = visitMemberAccess(expression) diff --git a/compiler/testData/ir/box/simple.kt b/compiler/testData/ir/box/simple.kt new file mode 100644 index 00000000000..82aade2a27f --- /dev/null +++ b/compiler/testData/ir/box/simple.kt @@ -0,0 +1,3 @@ +class Test(val ok: String) + +fun box() = Test("OK").ok \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt index 03754e76ec0..8e5fc0fd0ed 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt @@ -12,7 +12,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Base' type=Base + receiver: GET_VAR '' type=Base origin=null PROPERTY public final val y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.Int EXPRESSION_BODY @@ -21,7 +21,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'Base' type=Base + receiver: GET_VAR '' type=Base origin=null CLASS CLASS Test1 CONSTRUCTOR public constructor Test1(xx: kotlin.Int, yy: kotlin.Int) BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/classMembers.txt b/compiler/testData/ir/irText/classes/classMembers.txt index 354dfef75bd..0809a5a9532 100644 --- a/compiler/testData/ir/irText/classes/classMembers.txt +++ b/compiler/testData/ir/irText/classes/classMembers.txt @@ -14,7 +14,7 @@ FILE /classMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final var z: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var z: kotlin.Int EXPRESSION_BODY @@ -23,11 +23,11 @@ FILE /classMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'z: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'z: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CONSTRUCTOR public constructor C() BLOCK_BODY @@ -43,7 +43,7 @@ FILE /classMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'property: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final val propertyWithGet: kotlin.Int FUN public final fun (): kotlin.Int BLOCK_BODY @@ -54,11 +54,11 @@ FILE /classMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'C' type=C + $this: GET_VAR '' type=C origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=EQ - $this: THIS of 'C' type=C + $this: GET_VAR '' type=C origin=null : GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null FUN public final fun function(): kotlin.Unit BLOCK_BODY @@ -87,7 +87,7 @@ FILE /classMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Unit' CALL 'foo(): Unit' type=kotlin.Unit origin=null - $this: THIS of 'NestedInterface' type=C.NestedInterface + $this: GET_VAR '' type=C.NestedInterface origin=null CLASS OBJECT companion object of C CONSTRUCTOR private constructor Companion() BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/dataClasses.txt b/compiler/testData/ir/irText/classes/dataClasses.txt index c266bf50e46..6193fbee4d0 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.txt @@ -12,7 +12,7 @@ FILE /dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null PROPERTY public final val y: kotlin.String FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.String EXPRESSION_BODY @@ -21,7 +21,7 @@ FILE /dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'y: String' type=kotlin.String origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null PROPERTY public final val z: kotlin.Any FIELD PROPERTY_BACKING_FIELD public final val z: kotlin.Any EXPRESSION_BODY @@ -30,22 +30,22 @@ FILE /dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' GET_FIELD 'z: Any' type=kotlin.Any origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component2(): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='component2(): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component3(): kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='component3(): Any' CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: kotlin.Int = ..., y: kotlin.String = ..., z: kotlin.Any = ...): Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='copy(Int = ..., String = ..., Any = ...): Test1' @@ -60,15 +60,15 @@ FILE /dataClasses.kt CONST String type=kotlin.String value='Test1(' CONST String type=kotlin.String value='x=' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null CONST String type=kotlin.String value=', ' CONST String type=kotlin.String value='y=' CALL '(): String' type=kotlin.String origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null CONST String type=kotlin.String value=', ' CONST String type=kotlin.String value='z=' CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null CONST String type=kotlin.String value=')' FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int BLOCK_BODY @@ -77,7 +77,7 @@ FILE /dataClasses.kt SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ CALL 'plus(Int): Int' type=kotlin.Int origin=null $this: CALL 'times(Int): Int' type=kotlin.Int origin=null @@ -85,7 +85,7 @@ FILE /dataClasses.kt other: CONST Int type=kotlin.Int value='31' other: CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: CALL '(): String' type=kotlin.String origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ CALL 'plus(Int): Int' type=kotlin.Int origin=null $this: CALL 'times(Int): Int' type=kotlin.Int origin=null @@ -93,7 +93,7 @@ FILE /dataClasses.kt other: CONST Int type=kotlin.Int value='31' other: CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean @@ -101,7 +101,7 @@ FILE /dataClasses.kt WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ - arg0: THIS of 'Test1' type=Test1 + arg0: GET_VAR '' type=Test1 origin=null arg1: GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value='true' @@ -119,7 +119,7 @@ FILE /dataClasses.kt if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null arg1: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' @@ -129,7 +129,7 @@ FILE /dataClasses.kt if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL '(): String' type=kotlin.String origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null arg1: CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' @@ -139,7 +139,7 @@ FILE /dataClasses.kt if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - $this: THIS of 'Test1' type=Test1 + $this: GET_VAR '' type=Test1 origin=null arg1: CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY $this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.txt index b81b7c3a8ef..1d9b1f5814d 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.txt @@ -22,34 +22,34 @@ FILE /delegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'x: String' type=kotlin.String origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null PROPERTY public abstract var y: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'y: Int' type=kotlin.Unit origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public abstract val kotlin.Byte.z1: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' GET_FIELD 'z1: Int on Byte' type=kotlin.Int origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null PROPERTY public abstract var kotlin.Byte.z2: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' GET_FIELD 'z2: Int on Byte' type=kotlin.Int origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'z2: Int on Byte' type=kotlin.Unit origin=null - receiver: THIS of 'IOther' type=IOther + receiver: GET_VAR '' type=IOther origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun otherImpl(x0: kotlin.String, y0: kotlin.Int): IOther BLOCK_BODY @@ -68,7 +68,7 @@ FILE /delegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'x: String' type=kotlin.String origin=null - receiver: THIS of '' type=otherImpl. + receiver: GET_VAR '>' type=otherImpl. origin=null PROPERTY public open override var y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public open override var y: kotlin.Int EXPRESSION_BODY @@ -77,11 +77,11 @@ FILE /delegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of '' type=otherImpl. + receiver: GET_VAR '>' type=otherImpl. origin=null FUN DEFAULT_PROPERTY_ACCESSOR public open override fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'y: Int' type=kotlin.Unit origin=null - receiver: THIS of '' type=otherImpl. + receiver: GET_VAR '>' type=otherImpl. origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public open override val kotlin.Byte.z1: kotlin.Int FUN public open override fun kotlin.Byte.(): kotlin.Int @@ -119,7 +119,7 @@ FILE /delegatedImplementation.kt BLOCK_BODY CALL 'qux() on String: Unit' type=kotlin.Unit origin=null $this: GET_VAR '`Test1$IBase$delegate`: BaseImpl' type=BaseImpl origin=null - $receiver: $RECEIVER of 'qux() on String: Unit' type=kotlin.String + $receiver: GET_VAR '' type=kotlin.String origin=null CLASS CLASS Test2 CONSTRUCTOR public constructor Test2() BLOCK_BODY @@ -143,7 +143,7 @@ FILE /delegatedImplementation.kt BLOCK_BODY CALL 'qux() on String: Unit' type=kotlin.Unit origin=null $this: GET_VAR '`Test2$IBase$delegate`: BaseImpl' type=BaseImpl origin=null - $receiver: $RECEIVER of 'qux() on String: Unit' type=kotlin.String + $receiver: GET_VAR '' type=kotlin.String origin=null FIELD DELEGATE val `Test2$IOther$delegate`: IOther EXPRESSION_BODY CALL 'otherImpl(String, Int): IOther' type=IOther origin=null @@ -155,7 +155,7 @@ FILE /delegatedImplementation.kt RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int origin=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther origin=null - $receiver: $RECEIVER of 'z1: Int on Byte' type=kotlin.Byte + $receiver: GET_VAR '' type=kotlin.Byte origin=null PROPERTY DELEGATED_MEMBER public open override val x: kotlin.String FUN DELEGATED_MEMBER public open override fun (): kotlin.String BLOCK_BODY @@ -168,12 +168,12 @@ FILE /delegatedImplementation.kt RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int origin=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther origin=null - $receiver: $RECEIVER of 'z2: Int on Byte' type=kotlin.Byte + $receiver: GET_VAR '' type=kotlin.Byte origin=null FUN DELEGATED_MEMBER public open override fun kotlin.Byte.(: kotlin.Int): kotlin.Unit BLOCK_BODY CALL '(Int) on Byte: Unit' type=kotlin.Unit origin=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther origin=null - $receiver: $RECEIVER of 'z2: Int on Byte' type=kotlin.Byte + $receiver: GET_VAR '' type=kotlin.Byte origin=null : GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY DELEGATED_MEMBER public open override var y: kotlin.Int FUN DELEGATED_MEMBER public open override fun (): kotlin.Int diff --git a/compiler/testData/ir/irText/classes/enum.txt b/compiler/testData/ir/irText/classes/enum.txt index 1d8e558f76f..b773c985e1b 100644 --- a/compiler/testData/ir/irText/classes/enum.txt +++ b/compiler/testData/ir/irText/classes/enum.txt @@ -25,7 +25,7 @@ FILE /enum.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestEnum2' type=TestEnum2 + receiver: GET_VAR '' type=TestEnum2 origin=null ENUM_ENTRY enum entry TEST1 init: ENUM_CONSTRUCTOR_CALL 'constructor TestEnum2(Int)' x: CONST Int type=kotlin.Int value='1' @@ -73,7 +73,7 @@ FILE /enum.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestEnum4' type=TestEnum4 + receiver: GET_VAR '' type=TestEnum4 origin=null ENUM_ENTRY enum entry TEST1 init: ENUM_CONSTRUCTOR_CALL 'constructor TEST1()' class: CLASS ENUM_ENTRY TEST1 @@ -100,13 +100,13 @@ FILE /enum.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'z: Int' type=kotlin.Int origin=null - receiver: THIS of 'TEST2' type=TestEnum4.TEST2 + receiver: GET_VAR '' type=TestEnum4.TEST2 origin=null ANONYMOUS_INITIALIZER TEST2 BLOCK_BODY SET_FIELD 'z: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TEST2' type=TestEnum4.TEST2 + receiver: GET_VAR '' type=TestEnum4.TEST2 origin=null value: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'TEST2' type=TestEnum4.TEST2 + $this: GET_VAR '' type=TestEnum4.TEST2 origin=null FUN public open override fun foo(): kotlin.Unit BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt index e25c342f719..2fc22922102 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt @@ -12,7 +12,7 @@ FILE /enumWithSecondaryCtor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test0' type=Test0 + receiver: GET_VAR '' type=Test0 origin=null ENUM_ENTRY enum entry ZERO init: ENUM_CONSTRUCTOR_CALL 'constructor Test0()' CONSTRUCTOR private constructor Test0() @@ -36,7 +36,7 @@ FILE /enumWithSecondaryCtor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null ENUM_ENTRY enum entry ZERO init: ENUM_CONSTRUCTOR_CALL 'constructor Test1()' ENUM_ENTRY enum entry ONE @@ -63,7 +63,7 @@ FILE /enumWithSecondaryCtor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test2' type=Test2 + receiver: GET_VAR '' type=Test2 origin=null ENUM_ENTRY enum entry ZERO init: ENUM_CONSTRUCTOR_CALL 'constructor ZERO()' class: CLASS ENUM_ENTRY ZERO diff --git a/compiler/testData/ir/irText/classes/initBlock.txt b/compiler/testData/ir/irText/classes/initBlock.txt index 412755aa3c3..bcc7d21f30d 100644 --- a/compiler/testData/ir/irText/classes/initBlock.txt +++ b/compiler/testData/ir/irText/classes/initBlock.txt @@ -20,7 +20,7 @@ FILE /initBlock.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test2' type=Test2 + receiver: GET_VAR '' type=Test2 origin=null ANONYMOUS_INITIALIZER Test2 BLOCK_BODY CALL 'println(): Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/classes/initVal.txt b/compiler/testData/ir/irText/classes/initVal.txt index 3af535cefab..a564f5bffba 100644 --- a/compiler/testData/ir/irText/classes/initVal.txt +++ b/compiler/testData/ir/irText/classes/initVal.txt @@ -12,7 +12,7 @@ FILE /initVal.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitValFromParameter' type=TestInitValFromParameter + receiver: GET_VAR '' type=TestInitValFromParameter origin=null CLASS CLASS TestInitValInClass CONSTRUCTOR public constructor TestInitValInClass() BLOCK_BODY @@ -26,7 +26,7 @@ FILE /initVal.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitValInClass' type=TestInitValInClass + receiver: GET_VAR '' type=TestInitValInClass origin=null CLASS CLASS TestInitValInInitBlock CONSTRUCTOR public constructor TestInitValInInitBlock() BLOCK_BODY @@ -38,9 +38,9 @@ FILE /initVal.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitValInInitBlock' type=TestInitValInInitBlock + receiver: GET_VAR '' type=TestInitValInInitBlock origin=null ANONYMOUS_INITIALIZER TestInitValInInitBlock BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TestInitValInInitBlock' type=TestInitValInInitBlock + receiver: GET_VAR '' type=TestInitValInInitBlock origin=null value: CONST Int type=kotlin.Int value='0' diff --git a/compiler/testData/ir/irText/classes/initVar.txt b/compiler/testData/ir/irText/classes/initVar.txt index d065712041d..f5902852114 100644 --- a/compiler/testData/ir/irText/classes/initVar.txt +++ b/compiler/testData/ir/irText/classes/initVar.txt @@ -12,11 +12,11 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarFromParameter' type=TestInitVarFromParameter + receiver: GET_VAR '' type=TestInitVarFromParameter origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TestInitVarFromParameter' type=TestInitVarFromParameter + receiver: GET_VAR '' type=TestInitVarFromParameter origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS CLASS TestInitVarInClass CONSTRUCTOR public constructor TestInitVarInClass() @@ -31,11 +31,11 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarInClass' type=TestInitVarInClass + receiver: GET_VAR '' type=TestInitVarInClass origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TestInitVarInClass' type=TestInitVarInClass + receiver: GET_VAR '' type=TestInitVarInClass origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS CLASS TestInitVarInInitBlock CONSTRUCTOR public constructor TestInitVarInInitBlock() @@ -48,16 +48,16 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarInInitBlock' type=TestInitVarInInitBlock + receiver: GET_VAR '' type=TestInitVarInInitBlock origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TestInitVarInInitBlock' type=TestInitVarInInitBlock + receiver: GET_VAR '' type=TestInitVarInInitBlock origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null ANONYMOUS_INITIALIZER TestInitVarInInitBlock BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=EQ - $this: THIS of 'TestInitVarInInitBlock' type=TestInitVarInInitBlock + $this: GET_VAR '' type=TestInitVarInInitBlock origin=null : CONST Int type=kotlin.Int value='0' CLASS CLASS TestInitVarWithCustomSetter CONSTRUCTOR public constructor TestInitVarWithCustomSetter() @@ -72,7 +72,7 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarWithCustomSetter' type=TestInitVarWithCustomSetter + receiver: GET_VAR '' type=TestInitVarWithCustomSetter origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ @@ -84,7 +84,7 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarWithCustomSetterWithExplicitCtor' type=TestInitVarWithCustomSetterWithExplicitCtor + receiver: GET_VAR '' type=TestInitVarWithCustomSetterWithExplicitCtor origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ @@ -92,7 +92,7 @@ FILE /initVar.kt ANONYMOUS_INITIALIZER TestInitVarWithCustomSetterWithExplicitCtor BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=EQ - $this: THIS of 'TestInitVarWithCustomSetterWithExplicitCtor' type=TestInitVarWithCustomSetterWithExplicitCtor + $this: GET_VAR '' type=TestInitVarWithCustomSetterWithExplicitCtor origin=null value: CONST Int type=kotlin.Int value='0' CONSTRUCTOR public constructor TestInitVarWithCustomSetterWithExplicitCtor() BLOCK_BODY @@ -105,7 +105,7 @@ FILE /initVar.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitVarWithCustomSetterInCtor' type=TestInitVarWithCustomSetterInCtor + receiver: GET_VAR '' type=TestInitVarWithCustomSetterInCtor origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ @@ -115,5 +115,5 @@ FILE /initVar.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarWithCustomSetterInCtor' CALL '(Int): Unit' type=kotlin.Unit origin=EQ - $this: THIS of 'TestInitVarWithCustomSetterInCtor' type=TestInitVarWithCustomSetterInCtor + $this: GET_VAR '' type=TestInitVarWithCustomSetterInCtor origin=null value: CONST Int type=kotlin.Int value='42' diff --git a/compiler/testData/ir/irText/classes/innerClass.txt b/compiler/testData/ir/irText/classes/innerClass.txt index eb757652086..2cdb5b8e8cf 100644 --- a/compiler/testData/ir/irText/classes/innerClass.txt +++ b/compiler/testData/ir/irText/classes/innerClass.txt @@ -13,5 +13,5 @@ FILE /innerClass.kt CONSTRUCTOR public constructor DerivedInnerClass() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor TestInnerClass()' - $this: THIS of 'Outer' type=Outer + $this: GET_VAR '' type=Outer origin=null INSTANCE_INITIALIZER_CALL classDescriptor='DerivedInnerClass' diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt index 7463bd1641b..a843d268248 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt @@ -51,7 +51,7 @@ FILE /objectLiteralExpressions.kt CONSTRUCTOR public constructor () BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Inner()' - $this: THIS of 'Outer' type=Outer + $this: GET_VAR '' type=Outer origin=null INSTANCE_INITIALIZER_CALL classDescriptor='' FUN public open override fun foo(): kotlin.Unit BLOCK_BODY @@ -66,7 +66,7 @@ FILE /objectLiteralExpressions.kt CONSTRUCTOR public constructor () BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Inner()' - $this: $RECEIVER of 'test4() on Outer: Outer.Inner' type=Outer + $this: GET_VAR '' type=Outer origin=null INSTANCE_INITIALIZER_CALL classDescriptor='' FUN public open override fun foo(): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.txt index f93671c9a56..64f5a1c8b88 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.txt @@ -17,17 +17,17 @@ FILE /objectWithInitializers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test' type=Test + receiver: GET_VAR '' type=Test origin=null PROPERTY public final val y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test' type=Test + receiver: GET_VAR '' type=Test origin=null ANONYMOUS_INITIALIZER Test BLOCK_BODY SET_FIELD 'y: Int' type=kotlin.Unit origin=null - receiver: THIS of 'Test' type=Test + receiver: GET_VAR '' type=Test origin=null value: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'Test' type=Test + $this: GET_VAR '' type=Test origin=null diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.kt b/compiler/testData/ir/irText/classes/outerClassAccess.kt new file mode 100644 index 00000000000..605d2f315f3 --- /dev/null +++ b/compiler/testData/ir/irText/classes/outerClassAccess.kt @@ -0,0 +1,20 @@ +class Outer { + fun foo() {} + + inner class Inner { + fun test() { + foo() + } + + inner class Inner2 { + fun test2() { + test() + foo() + } + + fun Outer.test3() { + foo() + } + } + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.txt b/compiler/testData/ir/irText/classes/outerClassAccess.txt new file mode 100644 index 00000000000..04baa86dd57 --- /dev/null +++ b/compiler/testData/ir/irText/classes/outerClassAccess.txt @@ -0,0 +1,32 @@ +FILE /outerClassAccess.kt + CLASS CLASS Outer + CONSTRUCTOR public constructor Outer() + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Outer' + FUN public final fun foo(): kotlin.Unit + BLOCK_BODY + CLASS CLASS Inner + CONSTRUCTOR public constructor Inner() + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Inner' + FUN public final fun test(): kotlin.Unit + BLOCK_BODY + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR '' type=Outer origin=null + CLASS CLASS Inner2 + CONSTRUCTOR public constructor Inner2() + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Inner2' + FUN public final fun test2(): kotlin.Unit + BLOCK_BODY + CALL 'test(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR '' type=Outer.Inner origin=null + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR '' type=Outer origin=null + FUN public final fun Outer.test3(): kotlin.Unit + BLOCK_BODY + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR '' type=Outer origin=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.txt b/compiler/testData/ir/irText/classes/primaryConstructor.txt index 41765e3c392..6c00d041be0 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.txt @@ -12,7 +12,7 @@ FILE /primaryConstructor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null PROPERTY public final val y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.Int EXPRESSION_BODY @@ -21,7 +21,7 @@ FILE /primaryConstructor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test1' type=Test1 + receiver: GET_VAR '' type=Test1 origin=null CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(x: kotlin.Int, y: kotlin.Int) BLOCK_BODY @@ -35,7 +35,7 @@ FILE /primaryConstructor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test2' type=Test2 + receiver: GET_VAR '' type=Test2 origin=null PROPERTY public final val x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int EXPRESSION_BODY @@ -44,7 +44,7 @@ FILE /primaryConstructor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test2' type=Test2 + receiver: GET_VAR '' type=Test2 origin=null CLASS CLASS Test3 CONSTRUCTOR public constructor Test3(x: kotlin.Int, y: kotlin.Int) BLOCK_BODY @@ -58,16 +58,16 @@ FILE /primaryConstructor.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test3' type=Test3 + receiver: GET_VAR '' type=Test3 origin=null PROPERTY public final val x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test3' type=Test3 + receiver: GET_VAR '' type=Test3 origin=null ANONYMOUS_INITIALIZER Test3 BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'Test3' type=Test3 + receiver: GET_VAR '' type=Test3 origin=null value: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt index 8f3e08b5c27..f8436fe4645 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt @@ -27,7 +27,7 @@ FILE /primaryConstructorWithSuperConstructorCall.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestWithDelegatingConstructor' type=TestWithDelegatingConstructor + receiver: GET_VAR '' type=TestWithDelegatingConstructor origin=null PROPERTY public final val y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.Int EXPRESSION_BODY @@ -36,7 +36,7 @@ FILE /primaryConstructorWithSuperConstructorCall.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestWithDelegatingConstructor' type=TestWithDelegatingConstructor + receiver: GET_VAR '' type=TestWithDelegatingConstructor origin=null CONSTRUCTOR public constructor TestWithDelegatingConstructor(x: kotlin.Int) BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor TestWithDelegatingConstructor(Int, Int)' diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt index 7acbab334d4..0383eec7856 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt @@ -23,15 +23,15 @@ FILE /qualifiedSuperCalls.kt FUN public open override fun foo(): kotlin.Unit BLOCK_BODY CALL 'foo(): Unit' superQualifier=ILeft type=kotlin.Unit origin=null - $this: THIS of 'CBoth' type=ILeft + $this: GET_VAR '' type=CBoth origin=null CALL 'foo(): Unit' superQualifier=IRight type=kotlin.Unit origin=null - $this: THIS of 'CBoth' type=IRight + $this: GET_VAR '' type=CBoth origin=null PROPERTY public open override val bar: kotlin.Int FUN public open override fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'plus(Int): Int' type=kotlin.Int origin=PLUS $this: CALL '(): Int' superQualifier=ILeft type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'CBoth' type=ILeft + $this: GET_VAR '' type=CBoth origin=null other: CALL '(): Int' superQualifier=IRight type=kotlin.Int origin=GET_PROPERTY - $this: THIS of 'CBoth' type=IRight + $this: GET_VAR '' type=CBoth origin=null diff --git a/compiler/testData/ir/irText/classes/sealedClasses.txt b/compiler/testData/ir/irText/classes/sealedClasses.txt index 7f8f290d01a..d5f2f99d4c0 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.txt @@ -17,7 +17,7 @@ FILE /sealedClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Double' GET_FIELD 'number: Double' type=kotlin.Double origin=null - receiver: THIS of 'Const' type=Expr.Const + receiver: GET_VAR '' type=Expr.Const origin=null CLASS CLASS Sum CONSTRUCTOR public constructor Sum(e1: Expr, e2: Expr) BLOCK_BODY @@ -31,7 +31,7 @@ FILE /sealedClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Expr' GET_FIELD 'e1: Expr' type=Expr origin=null - receiver: THIS of 'Sum' type=Expr.Sum + receiver: GET_VAR '' type=Expr.Sum origin=null PROPERTY public final val e2: Expr FIELD PROPERTY_BACKING_FIELD public final val e2: Expr EXPRESSION_BODY @@ -40,7 +40,7 @@ FILE /sealedClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Expr' GET_FIELD 'e2: Expr' type=Expr origin=null - receiver: THIS of 'Sum' type=Expr.Sum + receiver: GET_VAR '' type=Expr.Sum origin=null CLASS OBJECT NotANumber CONSTRUCTOR private constructor NotANumber() BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt index 900b6a004eb..c2dcf174bc6 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt @@ -13,7 +13,7 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestProperty' type=TestProperty + receiver: GET_VAR '' type=TestProperty origin=null CONSTRUCTOR public constructor TestProperty() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' @@ -25,11 +25,11 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestInitBlock' type=TestInitBlock + receiver: GET_VAR '' type=TestInitBlock origin=null ANONYMOUS_INITIALIZER TestInitBlock BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'TestInitBlock' type=TestInitBlock + receiver: GET_VAR '' type=TestInitBlock origin=null value: CONST Int type=kotlin.Int value='0' CONSTRUCTOR public constructor TestInitBlock() BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/superCalls.txt b/compiler/testData/ir/irText/classes/superCalls.txt index 2a4659a66b1..0053a95a1ca 100644 --- a/compiler/testData/ir/irText/classes/superCalls.txt +++ b/compiler/testData/ir/irText/classes/superCalls.txt @@ -14,7 +14,7 @@ FILE /superCalls.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'bar: String' type=kotlin.String origin=null - receiver: THIS of 'Base' type=Base + receiver: GET_VAR '' type=Base origin=null CLASS CLASS Derived CONSTRUCTOR public constructor Derived() BLOCK_BODY @@ -23,10 +23,10 @@ FILE /superCalls.kt FUN public open override fun foo(): kotlin.Unit BLOCK_BODY CALL 'foo(): Unit' superQualifier=Base type=kotlin.Unit origin=null - $this: THIS of 'Derived' type=Base + $this: GET_VAR '' type=Derived origin=null PROPERTY public open override val bar: kotlin.String FUN public open override fun (): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL '(): String' superQualifier=Base type=kotlin.String origin=GET_PROPERTY - $this: THIS of 'Derived' type=Base + $this: GET_VAR '' type=Derived origin=null diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.txt index bbb39044407..f97f03cda71 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.txt @@ -12,7 +12,7 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final val test2: kotlin.Int FUN public final fun (): kotlin.Int BLOCK_BODY @@ -26,11 +26,11 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test3: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'test3: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public final var test4: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var test4: kotlin.Int @@ -40,7 +40,7 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test4: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'test4: Int' type=kotlin.Unit origin=EQ @@ -53,11 +53,11 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test5: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN private final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'test5: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public final val test6: kotlin.Int = 1 FIELD PROPERTY_BACKING_FIELD public final val test6: kotlin.Int = 1 @@ -67,7 +67,7 @@ FILE /classLevelProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test6: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final val test7: kotlin.Int FIELD DELEGATE val `test7$delegate`: kotlin.Lazy EXPRESSION_BODY @@ -85,8 +85,8 @@ FILE /classLevelProperties.kt 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 + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test7: Int' type=kotlin.reflect.KProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY public final var test8: kotlin.Int FIELD DELEGATE val `test8$delegate`: java.util.HashMap @@ -100,8 +100,8 @@ FILE /classLevelProperties.kt 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 + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY @@ -109,7 +109,7 @@ FILE /classLevelProperties.kt 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 + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.txt index 5d33d30a281..442fb15c428 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.txt @@ -31,7 +31,7 @@ FILE /delegatedProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): MutableMap' GET_FIELD 'map: MutableMap' type=kotlin.collections.MutableMap origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final val test2: kotlin.Int FIELD DELEGATE val `test2$delegate`: kotlin.Lazy EXPRESSION_BODY @@ -49,22 +49,22 @@ FILE /delegatedProperties.kt 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 + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test2: Int' type=kotlin.reflect.KProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY public final var test3: kotlin.Any FIELD DELEGATE val `test3$delegate`: kotlin.collections.MutableMap EXPRESSION_BODY CALL '(): MutableMap' type=kotlin.collections.MutableMap origin=GET_PROPERTY - $this: THIS of 'C' type=C + $this: GET_VAR '' type=C origin=null FUN DELEGATED_PROPERTY_ACCESSOR public final 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 '`test3$delegate`: MutableMap' type=kotlin.collections.MutableMap origin=null - receiver: THIS of 'C' type=C - thisRef: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test3: Any' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun (: kotlin.Any): kotlin.Unit BLOCK_BODY @@ -72,8 +72,8 @@ FILE /delegatedProperties.kt 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 + receiver: GET_VAR '' type=C origin=null + thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test3: Any' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE value: GET_VAR 'value-parameter : Any' type=kotlin.Any origin=null PROPERTY public var test4: kotlin.Any diff --git a/compiler/testData/ir/irText/declarations/interfaceProperties.txt b/compiler/testData/ir/irText/declarations/interfaceProperties.txt index 9fc7e69856b..df3d162e1e8 100644 --- a/compiler/testData/ir/irText/declarations/interfaceProperties.txt +++ b/compiler/testData/ir/irText/declarations/interfaceProperties.txt @@ -5,7 +5,7 @@ FILE /interfaceProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public open val test2: kotlin.Int FUN public open fun (): kotlin.Int BLOCK_BODY @@ -16,11 +16,11 @@ FILE /interfaceProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test3: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'test3: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public open var test4: kotlin.Int FUN public open fun (): kotlin.Int diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt index ae8bf62a04d..5980a6e072b 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt @@ -14,4 +14,4 @@ FILE /primaryCtorDefaultArguments.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Test' type=Test + receiver: GET_VAR '' type=Test origin=null diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt index 1f39d486ddd..24777292434 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt @@ -12,7 +12,7 @@ FILE /primaryCtorProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null PROPERTY public final var test2: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var test2: kotlin.Int EXPRESSION_BODY @@ -21,9 +21,9 @@ FILE /primaryCtorProperties.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test2: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'test2: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt index 6c6d3cbb61a..1dc77ae02c8 100644 --- a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt @@ -9,4 +9,4 @@ FILE /suppressedNonPublicCall.kt FUN public inline fun C.foo(): kotlin.Unit BLOCK_BODY CALL 'bar(): Unit' type=kotlin.Unit origin=null - $this: $RECEIVER of 'foo() on C: Unit' type=C + $this: GET_VAR '' type=C origin=null diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt index b10ce162f1f..37b4c7bda41 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt @@ -24,7 +24,7 @@ FILE /arrayAugmentedAssignment1.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): IntArray' GET_FIELD 'x: IntArray' type=kotlin.IntArray origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN public fun testVariable(): kotlin.Unit BLOCK_BODY VAR var x: kotlin.IntArray diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt index 1c121c28056..ab9318d6751 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt @@ -11,7 +11,7 @@ FILE /arrayAugmentedAssignment2.kt VAR IR_TEMPORARY_VARIABLE val tmp1_index0: kotlin.String CONST String type=kotlin.String value='' CALL 'set(String, Int) on IA: Unit' type=kotlin.Unit origin=PLUSEQ - $this: $RECEIVER of 'test(IA) on IB: Unit' type=IB + $this: GET_VAR '' type=IB origin=null $receiver: GET_VAR 'tmp0_array: IA' type=IA origin=null index: GET_VAR 'tmp1_index0: String' type=kotlin.String origin=null value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ diff --git a/compiler/testData/ir/irText/expressions/assignments.txt b/compiler/testData/ir/irText/expressions/assignments.txt index 3ef986a8ff7..4fc50dfdf5f 100644 --- a/compiler/testData/ir/irText/expressions/assignments.txt +++ b/compiler/testData/ir/irText/expressions/assignments.txt @@ -12,11 +12,11 @@ FILE /assignments.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'Ref' type=Ref + receiver: GET_VAR '' type=Ref origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'Ref' type=Ref + receiver: GET_VAR '' type=Ref origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun test1(): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt index cf256bda5d5..8eba030793a 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt @@ -9,7 +9,7 @@ FILE /augmentedAssignmentWithExpression.kt FUN public final fun test1(): kotlin.Unit BLOCK_BODY CALL 'plusAssign(Int): Unit' type=kotlin.Unit origin=PLUSEQ - $this: THIS of 'Host' type=Host + $this: GET_VAR '' type=Host origin=null x: CONST Int type=kotlin.Int value='1' FUN public fun foo(): Host BLOCK_BODY @@ -18,7 +18,7 @@ FILE /augmentedAssignmentWithExpression.kt FUN public fun Host.test2(): kotlin.Unit BLOCK_BODY CALL 'plusAssign(Int): Unit' type=kotlin.Unit origin=PLUSEQ - $this: $RECEIVER of 'test2() on Host: Unit' type=Host + $this: GET_VAR '' type=Host origin=null x: CONST Int type=kotlin.Int value='1' FUN public fun test3(): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt index e37dabd9e09..2017667cacf 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt @@ -14,7 +14,7 @@ FILE /boundCallableReferences.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'bar: Int' type=kotlin.Int origin=null - receiver: THIS of 'A' type=A + receiver: GET_VAR '' type=A origin=null FUN public fun A.qux(): kotlin.Unit BLOCK_BODY PROPERTY public val test1: kotlin.reflect.KFunction0 diff --git a/compiler/testData/ir/irText/expressions/calls.txt b/compiler/testData/ir/irText/expressions/calls.txt index 417b9fdf871..1bb6ac5149c 100644 --- a/compiler/testData/ir/irText/expressions/calls.txt +++ b/compiler/testData/ir/irText/expressions/calls.txt @@ -20,17 +20,17 @@ FILE /calls.kt FUN public fun kotlin.Int.ext1(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='ext1() on Int: Int' - $RECEIVER of 'ext1() on Int: Int' type=kotlin.Int + GET_VAR '' type=kotlin.Int origin=null FUN public fun kotlin.Int.ext2(x: kotlin.Int): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='ext2(Int) on Int: Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null - x: $RECEIVER of 'ext2(Int) on Int: Int' type=kotlin.Int + x: GET_VAR '' type=kotlin.Int origin=null y: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null FUN public fun kotlin.Int.ext3(x: kotlin.Int): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='ext3(Int) on Int: Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null x: CALL 'ext1() on Int: Int' type=kotlin.Int origin=null - $receiver: $RECEIVER of 'ext3(Int) on Int: Int' type=kotlin.Int + $receiver: GET_VAR '' type=kotlin.Int origin=null y: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt index 6843b012082..fe3643eb3fb 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt @@ -7,11 +7,11 @@ FILE /chainOfSafeCalls.kt FUN public final fun foo(): C BLOCK_BODY RETURN type=kotlin.Nothing from='foo(): C' - THIS of 'C' type=C + GET_VAR '' type=C origin=null FUN public final fun bar(): C? BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): C?' - THIS of 'C' type=C + GET_VAR '' type=C origin=null FUN public fun test(nc: C?): C? BLOCK_BODY RETURN type=kotlin.Nothing from='test(C?): C?' diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt index 1e07252104b..5b2b92b86fb 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt @@ -12,11 +12,11 @@ FILE /complexAugmentedAssignment.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x1: Int' type=kotlin.Int origin=null - receiver: THIS of 'X1' type=X1 + receiver: GET_VAR '' type=X1 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x1: Int' type=kotlin.Unit origin=null - receiver: THIS of 'X1' type=X1 + receiver: GET_VAR '' type=X1 origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS OBJECT X2 CONSTRUCTOR private constructor X2() @@ -31,11 +31,11 @@ FILE /complexAugmentedAssignment.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x2: Int' type=kotlin.Int origin=null - receiver: THIS of 'X2' type=X1.X2 + receiver: GET_VAR '' type=X1.X2 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x2: Int' type=kotlin.Unit origin=null - receiver: THIS of 'X2' type=X1.X2 + receiver: GET_VAR '' type=X1.X2 origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS OBJECT X3 CONSTRUCTOR private constructor X3() @@ -50,11 +50,11 @@ FILE /complexAugmentedAssignment.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x3: Int' type=kotlin.Int origin=null - receiver: THIS of 'X3' type=X1.X2.X3 + receiver: GET_VAR '' type=X1.X2.X3 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x3: Int' type=kotlin.Unit origin=null - receiver: THIS of 'X3' type=X1.X2.X3 + receiver: GET_VAR '' type=X1.X2.X3 origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun test1(a: kotlin.IntArray): kotlin.Unit BLOCK_BODY @@ -138,11 +138,11 @@ FILE /complexAugmentedAssignment.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 's: Int' type=kotlin.Int origin=null - receiver: THIS of 'B' type=B + receiver: GET_VAR '' type=B origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 's: Int' type=kotlin.Unit origin=null - receiver: THIS of 'B' type=B + receiver: GET_VAR '' type=B origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS OBJECT Host CONSTRUCTOR private constructor Host() @@ -153,7 +153,7 @@ FILE /complexAugmentedAssignment.kt BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ VAR IR_TEMPORARY_VARIABLE val tmp0_this: B - $RECEIVER of 'plusAssign(B) on B: Unit' type=B + GET_VAR '' type=B origin=null CALL '(Int): Unit' type=kotlin.Unit origin=PLUSEQ $this: GET_VAR 'tmp0_this: B' type=B origin=null : CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ @@ -164,7 +164,7 @@ FILE /complexAugmentedAssignment.kt FUN public fun Host.test3(v: B): kotlin.Unit BLOCK_BODY CALL 'plusAssign(B) on B: Unit' type=kotlin.Unit origin=PLUSEQ - $this: $RECEIVER of 'test3(B) on Host: Unit' type=Host + $this: GET_VAR '' type=Host origin=null $receiver: GET_VAR 'value-parameter v: B' type=B origin=PLUSEQ b: CALL 'constructor B(Int = ...)' type=B origin=null s: CONST Int type=kotlin.Int value='1000' diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.txt index 78f5bb46930..1d6a43e2235 100644 --- a/compiler/testData/ir/irText/expressions/conventionComparisons.txt +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.txt @@ -7,7 +7,7 @@ FILE /conventionComparisons.kt RETURN type=kotlin.Nothing from='test1(IA, IA) on IB: Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT arg0: CALL 'compareTo(IA) on IA: Int' type=kotlin.Int origin=GT - $this: $RECEIVER of 'test1(IA, IA) on IB: Boolean' type=IB + $this: GET_VAR '' type=IB origin=null $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test2(a1: IA, a2: IA): kotlin.Boolean @@ -15,7 +15,7 @@ FILE /conventionComparisons.kt RETURN type=kotlin.Nothing from='test2(IA, IA) on IB: Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ arg0: CALL 'compareTo(IA) on IA: Int' type=kotlin.Int origin=GTEQ - $this: $RECEIVER of 'test2(IA, IA) on IB: Boolean' type=IB + $this: GET_VAR '' type=IB origin=null $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test3(a1: IA, a2: IA): kotlin.Boolean @@ -23,7 +23,7 @@ FILE /conventionComparisons.kt RETURN type=kotlin.Nothing from='test3(IA, IA) on IB: Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT arg0: CALL 'compareTo(IA) on IA: Int' type=kotlin.Int origin=LT - $this: $RECEIVER of 'test3(IA, IA) on IB: Boolean' type=IB + $this: GET_VAR '' type=IB origin=null $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test4(a1: IA, a2: IA): kotlin.Boolean @@ -31,6 +31,6 @@ FILE /conventionComparisons.kt RETURN type=kotlin.Nothing from='test4(IA, IA) on IB: Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ arg0: CALL 'compareTo(IA) on IA: Int' type=kotlin.Int origin=LTEQ - $this: $RECEIVER of 'test4(IA, IA) on IB: Boolean' type=IB + $this: GET_VAR '' type=IB origin=null $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null diff --git a/compiler/testData/ir/irText/expressions/destructuring1.txt b/compiler/testData/ir/irText/expressions/destructuring1.txt index 4413f2b4456..d198ab574ef 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.txt @@ -24,9 +24,9 @@ FILE /destructuring1.kt GET_OBJECT 'A' type=A VAR val x: kotlin.Int CALL 'component1() on A: Int' type=kotlin.Int origin=COMPONENT_N(index=1) - $this: $RECEIVER of 'test() on B: Unit' type=B + $this: GET_VAR '' type=B origin=null $receiver: GET_VAR 'tmp0_container: A' type=A origin=null VAR val y: kotlin.Int CALL 'component2() on A: Int' type=kotlin.Int origin=COMPONENT_N(index=2) - $this: $RECEIVER of 'test() on B: Unit' type=B + $this: GET_VAR '' type=B origin=null $receiver: GET_VAR 'tmp0_container: A' type=A origin=null diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt index 343326169c6..62be9045e78 100644 --- a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt @@ -8,4 +8,4 @@ FILE /extensionPropertyGetterCall.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test5() on String: String' CALL '() on String: String' type=kotlin.String origin=GET_PROPERTY - $receiver: $RECEIVER of 'test5() on String: String' type=kotlin.String + $receiver: GET_VAR '' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt index adecc8a2856..1d64e755c08 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt @@ -17,11 +17,11 @@ FILE /forWithImplicitReceivers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=null - receiver: THIS of 'IntCell' type=IntCell + receiver: GET_VAR '' type=IntCell origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=null - receiver: THIS of 'IntCell' type=IntCell + receiver: GET_VAR '' type=IntCell origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS INTERFACE IReceiver FUN public open operator fun FiveTimes.iterator(): IntCell @@ -35,14 +35,14 @@ FILE /forWithImplicitReceivers.kt CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=GT $this: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: $RECEIVER of 'hasNext() on IntCell: Boolean' type=IntCell + $this: GET_VAR '' type=IntCell origin=null other: CONST Int type=kotlin.Int value='0' FUN public open operator fun IntCell.next(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='next() on IntCell: Int' BLOCK type=kotlin.Int origin=POSTFIX_DECR VAR IR_TEMPORARY_VARIABLE val tmp0_this: IntCell - $RECEIVER of 'next() on IntCell: Int' type=IntCell + GET_VAR '' type=IntCell origin=null BLOCK type=kotlin.Int origin=POSTFIX_DECR VAR IR_TEMPORARY_VARIABLE val tmp1: kotlin.Int CALL '(): Int' type=kotlin.Int origin=POSTFIX_DECR @@ -57,16 +57,16 @@ FILE /forWithImplicitReceivers.kt BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: IntCell CALL 'iterator() on FiveTimes: IntCell' type=IntCell origin=FOR_LOOP_ITERATOR - $this: $RECEIVER of 'test() on IReceiver: Unit' type=IReceiver + $this: GET_VAR '' type=IReceiver origin=null $receiver: GET_OBJECT 'FiveTimes' type=FiveTimes WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'hasNext() on IntCell: Boolean' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: $RECEIVER of 'test() on IReceiver: Unit' type=IReceiver + $this: GET_VAR '' type=IReceiver origin=null $receiver: GET_VAR 'tmp0_iterator: IntCell' type=IntCell origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR val i: kotlin.Int CALL 'next() on IntCell: Int' type=kotlin.Int origin=FOR_LOOP_NEXT - $this: $RECEIVER of 'test() on IReceiver: Unit' type=IReceiver + $this: GET_VAR '' type=IReceiver origin=null $receiver: GET_VAR 'tmp0_iterator: IntCell' type=IntCell origin=null BLOCK type=kotlin.Unit origin=null CALL 'println(Int): Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt index ecf3b2c58a1..6ca8296bd08 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt @@ -7,15 +7,15 @@ FILE /Derived.kt ANONYMOUS_INITIALIZER Derived BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=EQ - receiver: THIS of 'Derived' type=Derived + receiver: GET_VAR '' type=Derived origin=null value: CONST Int type=kotlin.Int value='0' FUN public final fun getValue(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=GET_PROPERTY - receiver: THIS of 'Derived' type=Derived + receiver: GET_VAR '' type=Derived origin=null FUN public final fun setValue(value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=EQ - receiver: THIS of 'Derived' type=Derived + receiver: GET_VAR '' type=Derived origin=null value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt index b8344ce650b..d00140c9a2c 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt @@ -41,7 +41,7 @@ FILE /jvmStaticFieldReference.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test: Int' type=kotlin.Int origin=null - receiver: THIS of 'TestClass' type=TestClass + receiver: GET_VAR '' type=TestClass origin=null ANONYMOUS_INITIALIZER TestClass BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/references.txt b/compiler/testData/ir/irText/expressions/references.txt index 71ad53bee00..bf96be2f129 100644 --- a/compiler/testData/ir/irText/expressions/references.txt +++ b/compiler/testData/ir/irText/expressions/references.txt @@ -47,4 +47,4 @@ FILE /references.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test5() on String: String' CALL '() on String: String' type=kotlin.String origin=GET_PROPERTY - $receiver: $RECEIVER of 'test5() on String: String' type=kotlin.String + $receiver: GET_VAR '' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.txt b/compiler/testData/ir/irText/expressions/safeAssignment.txt index 3d9580fbf7c..5b2ee6a3d16 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.txt @@ -12,11 +12,11 @@ FILE /safeAssignment.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null - receiver: THIS of 'C' type=C + receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun test(nc: C?): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt index 0c731f5ae27..70bf2abd4df 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt @@ -16,7 +16,7 @@ FILE /safeCallWithIncrementDecrement.kt RETURN type=kotlin.Nothing from='inc() on Int?: Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.Int? - $RECEIVER of 'inc() on Int?: Int?' type=kotlin.Int? + GET_VAR '' type=kotlin.Int? origin=null WHEN type=kotlin.Int? origin=SAFE_CALL BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ diff --git a/compiler/testData/ir/irText/expressions/safeCalls.txt b/compiler/testData/ir/irText/expressions/safeCalls.txt index 32d78987e5b..ecf90934606 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.txt @@ -12,18 +12,18 @@ FILE /safeCalls.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=null - receiver: THIS of 'Ref' type=Ref + receiver: GET_VAR '' type=Ref origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=null - receiver: THIS of 'Ref' type=Ref + receiver: GET_VAR '' type=Ref origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS INTERFACE IHost FUN public open fun kotlin.String.extLength(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='extLength() on String: Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: $RECEIVER of 'extLength() on String: Int' type=kotlin.String + $this: GET_VAR '' type=kotlin.String origin=null FUN public fun test1(x: kotlin.String?): kotlin.Int? BLOCK_BODY RETURN type=kotlin.Nothing from='test1(String?): Int?' @@ -105,5 +105,5 @@ FILE /safeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value='true' then: CALL 'extLength() on String: Int' type=kotlin.Int origin=null - $this: $RECEIVER of 'test5(String?) on IHost: Int?' type=IHost + $this: GET_VAR '' type=IHost origin=null $receiver: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt index 3047c11816b..5eeba394f40 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt @@ -12,6 +12,6 @@ FILE /Derived.kt GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null then: BLOCK type=kotlin.Unit origin=null SET_FIELD 'value: String!' type=kotlin.Unit origin=EQ - receiver: THIS of 'Derived' type=Derived + receiver: GET_VAR '' type=Derived origin=null value: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String! GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt index 0390e915a6c..8572fd1f240 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt @@ -6,7 +6,7 @@ FILE /variableAsFunctionCall.kt FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' - $RECEIVER of 'k() on String: () -> String' type=kotlin.String + GET_VAR ' String>' type=kotlin.String origin=null CALLABLE_REFERENCE '(): String' type=() -> kotlin.String origin=LAMBDA FUN public fun test1(f: () -> kotlin.Unit): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.txt index 2867d60991a..5263d64305c 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.txt @@ -11,5 +11,5 @@ FILE /extensionLambda.kt BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: $RECEIVER of '() on String: Int' type=kotlin.String + $this: GET_VAR '() on String: Int>' type=kotlin.String origin=null CALLABLE_REFERENCE '() on String: Int' type=kotlin.String.() -> kotlin.Int origin=LAMBDA diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index 1c8459b5e0c..8cf1be99015 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -48,10 +48,10 @@ FILE /multipleImplicitReceivers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='() on IInvoke: Int' CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE - $this: $RECEIVER of '() on IInvoke: Int' type=IInvoke + $this: GET_VAR '() on IInvoke: Int>' type=IInvoke origin=null $receiver: CALL '() on A: B' type=B origin=GET_PROPERTY - $this: $RECEIVER of '() on IFoo: Int' type=IFoo - $receiver: $RECEIVER of '() on A: Int' type=A + $this: GET_VAR '() on IFoo: Int>' type=IFoo origin=null + $receiver: GET_VAR '() on A: Int>' type=A origin=null CALLABLE_REFERENCE '() on IInvoke: Int' type=IInvoke.() -> kotlin.Int origin=LAMBDA CALLABLE_REFERENCE '() on IFoo: Int' type=IFoo.() -> kotlin.Int origin=LAMBDA CALLABLE_REFERENCE '() on A: Int' type=A.() -> kotlin.Int origin=LAMBDA diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 00271589230..b2def39a271 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5655,6 +5655,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/delegationToVal.kt"); doTest(fileName); } + + @TestMetadata("kt8154.kt") + public void testKt8154() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @@ -13666,6 +13672,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("kt13381.kt") + public void testKt13381() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt13381.kt"); + doTest(fileName); + } + @TestMetadata("kt1406.kt") public void testKt1406() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt1406.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrOnlyBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrOnlyBoxCodegenTestGenerated.java index f760a28893d..2b01f478f7e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrOnlyBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrOnlyBoxCodegenTestGenerated.java @@ -70,4 +70,10 @@ public class IrOnlyBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTest String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/box/objectClass.kt"); doTest(fileName); } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/box/simple.kt"); + doTest(fileName); + } } diff --git a/compiler/tests/org/jetbrains/kotlin/ir/AbstractClosureAnnotatorTestCase.kt b/compiler/tests/org/jetbrains/kotlin/ir/AbstractClosureAnnotatorTestCase.kt index 04bbfc738df..b639cfeb1d1 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/AbstractClosureAnnotatorTestCase.kt +++ b/compiler/tests/org/jetbrains/kotlin/ir/AbstractClosureAnnotatorTestCase.kt @@ -72,7 +72,7 @@ abstract class AbstractClosureAnnotatorTestCase : AbstractIrGeneratorTestCase() closure.capturedReceiverParameters.forEach { actualOut.println(" receiver for ${it.containingDeclaration.name}") } - closure.capturedVariables.forEach { + closure.capturedValues.forEach { actualOut.println(" variable ${it.name}") } } diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 75149c97c6c..46b99cd2060 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -145,6 +145,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { doTest(fileName); } + @TestMetadata("outerClassAccess.kt") + public void testOuterClassAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/outerClassAccess.kt"); + doTest(fileName); + } + @TestMetadata("primaryConstructor.kt") public void testPrimaryConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/primaryConstructor.kt");