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 745cddb60c5..9ce81a553ca 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 @@ -19,11 +19,12 @@ package org.jetbrains.kotlin.backend.common import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrGeneralFunction -import org.jetbrains.kotlin.ir.declarations.IrLocalPropertyAccessor +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrLocalDelegatedProperty import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.ir.visitors.acceptVoid import org.jetbrains.kotlin.resolve.DescriptorUtils import java.util.* @@ -103,7 +104,7 @@ abstract class AbstractClosureAnnotator : IrElementVisitorVoid { closuresStack.peek()?.addNested(closure) } - override fun visitGeneralFunction(declaration: IrGeneralFunction) { + override fun visitFunction(declaration: IrFunction) { val functionDescriptor = declaration.descriptor val closureBuilder = ClosureBuilder(functionDescriptor) @@ -120,8 +121,9 @@ abstract class AbstractClosureAnnotator : IrElementVisitorVoid { closuresStack.peek()?.addNested(closure) } - override fun visitLocalPropertyAccessor(declaration: IrLocalPropertyAccessor) { - // Local property accessors are created for delegated local properties and have no closure. + override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) { + // Getter and setter of local delegated properties are special generated functions and don't have closure. + declaration.delegate.initializer?.acceptVoid(this) } override fun visitThisReference(expression: IrThisReference) { 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 863a6964fd4..1b01f014099 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 @@ -92,9 +92,9 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE extensionReceiverValue?.load(), IrOperator.GET_PROPERTY, call.superQualifier) - } ?: IrGetBackingFieldImpl(startOffset, endOffset, descriptor, - dispatchReceiverValue?.load(), - IrOperator.GET_PROPERTY, call.superQualifier) + } ?: IrGetFieldImpl(startOffset, endOffset, descriptor, + dispatchReceiverValue?.load(), + IrOperator.GET_PROPERTY, call.superQualifier) } } 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 1f130159f3b..d4449a6b5dd 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 @@ -112,8 +112,8 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator val superClass = superTypeConstructorDescriptor as? ClassDescriptor ?: throw AssertionError("Unexpected supertype constructor for delegation: $superTypeConstructorDescriptor") val delegateDescriptor = IrImplementingDelegateDescriptorImpl(irClass.descriptor, delegateType, superType) - val irDelegate = IrSimplePropertyImpl(ktDelegateExpression.startOffset, ktDelegateExpression.endOffset, IrDeclarationOrigin.DELEGATE, - delegateDescriptor) + val irDelegate = IrFieldImpl(ktDelegateExpression.startOffset, ktDelegateExpression.endOffset, IrDeclarationOrigin.DELEGATE, + delegateDescriptor) val bodyGenerator = BodyGenerator(irClass.descriptor, context) irDelegate.initializer = bodyGenerator.generatePropertyInitializerBody(ktDelegateExpression) irClass.addMember(irDelegate) @@ -126,7 +126,8 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } } - private fun generateDelegatedMember(irClass: IrClassImpl, irDelegate: IrSimplePropertyImpl, delegatedMember: CallableMemberDescriptor, overriddenMember: CallableMemberDescriptor) { + private fun generateDelegatedMember(irClass: IrClassImpl, irDelegate: IrFieldImpl, + delegatedMember: CallableMemberDescriptor, overriddenMember: CallableMemberDescriptor) { when (delegatedMember) { is FunctionDescriptor -> generateDelegatedFunction(irClass, irDelegate, delegatedMember, overriddenMember as FunctionDescriptor) @@ -136,15 +137,16 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } - private fun generateDelegatedProperty(irClass: IrClassImpl, irDelegate: IrSimplePropertyImpl, delegated: PropertyDescriptor, overridden: PropertyDescriptor) { - val irProperty = IrSimplePropertyImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated) + private fun generateDelegatedProperty(irClass: IrClassImpl, irDelegate: IrFieldImpl, + delegated: PropertyDescriptor, overridden: PropertyDescriptor) { + val irProperty = IrPropertyImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, false, delegated) - val irGetter = IrPropertyGetterImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.getter!!) + val irGetter = IrFunctionImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.getter!!) irGetter.body = generateDelegateFunctionBody(irDelegate, delegated.getter!!, overridden.getter!!) irProperty.getter = irGetter if (delegated.isVar) { - val irSetter = IrPropertySetterImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.setter!!) + val irSetter = IrFunctionImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.setter!!) irSetter.body = generateDelegateFunctionBody(irDelegate, delegated.setter!!, overridden.setter!!) irProperty.setter = irSetter } @@ -152,13 +154,13 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator irClass.addMember(irProperty) } - private fun generateDelegatedFunction(irClass: IrClassImpl, irDelegate: IrSimplePropertyImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor) { + private fun generateDelegatedFunction(irClass: IrClassImpl, irDelegate: IrFieldImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor) { val irFunction = IrFunctionImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated) irFunction.body = generateDelegateFunctionBody(irDelegate, delegated, overridden) irClass.addMember(irFunction) } - private fun generateDelegateFunctionBody(irDelegate: IrSimplePropertyImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrBlockBodyImpl { + private fun generateDelegateFunctionBody(irDelegate: IrFieldImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrBlockBodyImpl { val irBlockBody = IrBlockBodyImpl(irDelegate.startOffset, irDelegate.endOffset) val returnType = overridden.returnType!! val irCall = IrCallImpl(irDelegate.startOffset, irDelegate.endOffset, returnType, overridden) @@ -228,10 +230,12 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator private fun generatePropertyForPrimaryConstructorParameter(ktParameter: KtParameter): IrDeclaration { val valueParameterDescriptor = getOrFail(BindingContext.VALUE_PARAMETER, ktParameter) val propertyDescriptor = getOrFail(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, ktParameter) - val irProperty = IrSimplePropertyImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.DEFINED, propertyDescriptor) + val irProperty = IrPropertyImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.DEFINED, false, propertyDescriptor) + val irField = IrFieldImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, propertyDescriptor) + irProperty.backingField = irField val irGetParameter = IrGetVariableImpl(ktParameter.startOffset, ktParameter.endOffset, - valueParameterDescriptor, IrOperator.INITIALIZE_PROPERTY_FROM_PARAMETER) - irProperty.initializer = IrExpressionBodyImpl(ktParameter.startOffset, ktParameter.endOffset, irGetParameter) + valueParameterDescriptor, IrOperator.INITIALIZE_PROPERTY_FROM_PARAMETER) + irField.initializer = IrExpressionBodyImpl(ktParameter.startOffset, ktParameter.endOffset, irGetParameter) return irProperty } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt index ab17770d5fa..4e0158edc58 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.* import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.expressions.IrExpressionBody +import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset @@ -74,7 +75,7 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { return irAnonymousInitializer } - fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrGeneralFunction { + fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrFunction { val functionDescriptor = getOrFail(BindingContext.FUNCTION, ktFunction) val irFunction = IrFunctionImpl(ktFunction.startOffset, ktFunction.endOffset, IrDeclarationOrigin.DEFINED, functionDescriptor) val bodyGenerator = createBodyGenerator(functionDescriptor) @@ -83,7 +84,7 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { return irFunction } - fun generateSecondaryConstructor(ktConstructor: KtSecondaryConstructor) : IrGeneralFunction { + fun generateSecondaryConstructor(ktConstructor: KtSecondaryConstructor): IrFunction { if (ktConstructor.isConstructorDelegatingToSuper(context.bindingContext)) { return generateSecondaryConstructorWithNestedInitializers(ktConstructor) } @@ -96,7 +97,7 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { } - private fun generateSecondaryConstructorWithNestedInitializers(ktConstructor: KtSecondaryConstructor): IrGeneralFunction { + private fun generateSecondaryConstructorWithNestedInitializers(ktConstructor: KtSecondaryConstructor): IrFunction { val constructorDescriptor = getOrFail(BindingContext.CONSTRUCTOR, ktConstructor) val irConstructor = IrConstructorImpl(ktConstructor.startOffset, ktConstructor.endOffset, IrDeclarationOrigin.DEFINED, constructorDescriptor) val bodyGenerator = createBodyGenerator(constructorDescriptor) @@ -120,30 +121,87 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { return DelegatedPropertyGenerator(context).generateDelegatedProperty(ktProperty, ktDelegate, propertyDescriptor, irDelegateInitializer) } - private fun generateSimpleProperty(ktProperty: KtProperty, propertyDescriptor: PropertyDescriptor): IrSimplePropertyImpl { - val initializer = ktProperty.initializer?.let { generateInitializerBody(propertyDescriptor, it) } - val irProperty = IrSimplePropertyImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFINED, - propertyDescriptor, initializer) + private fun generateSimpleProperty(ktProperty: KtProperty, propertyDescriptor: PropertyDescriptor): IrProperty { + val irProperty = IrPropertyImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFINED, false, propertyDescriptor) + + val irField = if (propertyDescriptor.hasBackingField()) { + IrFieldImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, propertyDescriptor, + ktProperty.initializer?.let { generateInitializerBody(propertyDescriptor, it) }) + } + else null + irProperty.backingField = irField irProperty.getter = ktProperty.getter?.let { ktGetter -> val accessorDescriptor = getOrFail(BindingContext.PROPERTY_ACCESSOR, ktGetter) val getterDescriptor = accessorDescriptor as? PropertyGetterDescriptor ?: TODO("not a getter?") - val irGetter = IrPropertyGetterImpl(ktGetter.startOffset, ktGetter.endOffset, IrDeclarationOrigin.DEFINED, getterDescriptor) + val irGetter = IrFunctionImpl(ktGetter.startOffset, ktGetter.endOffset, IrDeclarationOrigin.DEFINED, getterDescriptor) irGetter.body = ktGetter.bodyExpression?.let { generateFunctionBody(getterDescriptor, it ) } irGetter - } + } ?: generateDefaultGetterIfRequired(ktProperty, irField) irProperty.setter = ktProperty.setter?.let { ktSetter -> val accessorDescriptor = getOrFail(BindingContext.PROPERTY_ACCESSOR, ktSetter) val setterDescriptor = accessorDescriptor as? PropertySetterDescriptor ?: TODO("not a setter?") - val irSetter = IrPropertySetterImpl(ktSetter.startOffset, ktSetter.endOffset, IrDeclarationOrigin.DEFINED, setterDescriptor) + val irSetter = IrFunctionImpl(ktSetter.startOffset, ktSetter.endOffset, IrDeclarationOrigin.DEFINED, setterDescriptor) irSetter.body = ktSetter.bodyExpression?.let { generateFunctionBody(setterDescriptor, it ) } irSetter - } + } ?: generateDefaultSetterIfRequired(ktProperty, irField) return irProperty } + private fun PropertyDescriptor.hasBackingField(): Boolean = + get(BindingContext.BACKING_FIELD_REQUIRED, this) ?: false + + private fun generateDefaultGetterIfRequired(ktProperty: KtProperty, irField: IrField?): IrFunction? { + if (irField == null) return null + + val property = irField.descriptor + val getter = property.getter ?: return null + + val irGetter = IrFunctionImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, getter) + val irBody = IrBlockBodyImpl(ktProperty.startOffset, ktProperty.endOffset) + irGetter.body = irBody + + val containingDeclaration = property.containingDeclaration + val receiver = + if (containingDeclaration is ClassDescriptor) + IrThisReferenceImpl(ktProperty.startOffset, ktProperty.endOffset, containingDeclaration.defaultType, + containingDeclaration) + else + null + + irBody.addStatement(IrReturnImpl(ktProperty.startOffset, ktProperty.endOffset, context.builtIns.nothingType, getter, + IrGetFieldImpl(ktProperty.startOffset, ktProperty.endOffset, property, receiver))) + + return irGetter + } + + private fun generateDefaultSetterIfRequired(ktProperty: KtProperty, irField: IrField?): IrFunction? { + if (irField == null) return null + + val property = irField.descriptor + if (!property.isVar) return null + val setter = property.setter ?: return null + + val irSetter = IrFunctionImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, setter) + val irBody = IrBlockBodyImpl(ktProperty.startOffset, ktProperty.endOffset) + irSetter.body = irBody + + val containingDeclaration = property.containingDeclaration + val receiver = + if (containingDeclaration is ClassDescriptor) + IrThisReferenceImpl(ktProperty.startOffset, ktProperty.endOffset, containingDeclaration.defaultType, + containingDeclaration) + else + null + + val setterParameter = setter.valueParameters.single() + irBody.addStatement(IrSetFieldImpl(ktProperty.startOffset, ktProperty.endOffset, property, receiver, + IrGetVariableImpl(ktProperty.startOffset, ktProperty.endOffset, setterParameter))) + + return irSetter + } private fun getPropertyDescriptor(ktProperty: KtProperty): PropertyDescriptor { val variableDescriptor = getOrFail(BindingContext.VARIABLE, ktProperty) 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 4a242cbda22..bc62c1b95cb 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 @@ -46,20 +46,20 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener ktDelegate: KtPropertyDelegate, propertyDescriptor: PropertyDescriptor, irDelegateInitializer: IrExpressionBody - ): IrDelegatedProperty { + ): IrProperty { val delegateDescriptor = createPropertyDelegateDescriptor(ktDelegate, propertyDescriptor) - val irDelegate = IrSimplePropertyImpl( + val irDelegate = IrFieldImpl( ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATE, delegateDescriptor, irDelegateInitializer) - val irProperty = IrDelegatedPropertyImpl( - ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFINED, + val irProperty = IrPropertyImpl( + ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFINED, true, propertyDescriptor, irDelegate) val delegateReceiverValue = createBackingFieldValueForDelegate(delegateDescriptor, ktDelegate) val getterDescriptor = propertyDescriptor.getter!! - irProperty.getter = IrPropertyGetterImpl( + irProperty.getter = IrFunctionImpl( ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, getterDescriptor, generateDelegatedPropertyGetterBody( @@ -68,7 +68,7 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener if (propertyDescriptor.isVar) { val setterDescriptor = propertyDescriptor.setter!! - irProperty.setter = IrPropertySetterImpl( + irProperty.setter = IrFunctionImpl( ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, setterDescriptor, generateDelegatedPropertySetterBody( @@ -89,14 +89,14 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener private fun createCallableReference(ktElement: KtElement, type: KotlinType, referencedDescriptor: CallableDescriptor): IrCallableReference = IrCallableReferenceImpl(ktElement.startOffset, ktElement.endOffset, type, - referencedDescriptor, IrOperator.PROPERTY_REFERENCE_FOR_DELEGATE) + referencedDescriptor, IrOperator.PROPERTY_REFERENCE_FOR_DELEGATE) fun generateLocalDelegatedProperty( ktProperty: KtProperty, ktDelegate: KtPropertyDelegate, variableDescriptor: VariableDescriptorWithAccessors, irDelegateInitializer: IrExpression - ) : IrLocalDelegatedProperty { + ): IrLocalDelegatedProperty { val delegateDescriptor = createLocalPropertyDelegatedDescriptor(ktDelegate, variableDescriptor) val irDelegate = IrVariableImpl( @@ -132,8 +132,8 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener VariableLValue(ktDelegate.startOffset, ktDelegate.endOffset, delegateDescriptor) private fun createLocalPropertyAccessor(getterDescriptor: VariableAccessorDescriptor, ktDelegate: KtPropertyDelegate, body: IrBody) = - IrLocalPropertyAccessorImpl(ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, - getterDescriptor, body) + IrFunctionImpl(ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, + getterDescriptor, body) private fun createLocalPropertyDelegatedDescriptor( ktDelegate: KtPropertyDelegate, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt index dd2c6d8c7ed..28b49ba1bf3 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt @@ -18,7 +18,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrGeneralFunction +import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl import org.jetbrains.kotlin.ir.expressions.impl.IrCallableReferenceImpl @@ -64,7 +64,7 @@ class LocalFunctionGenerator(statementGenerator: StatementGenerator) : Statement irBlock } - private fun generateFunctionDeclaration(ktFun: KtNamedFunction): IrGeneralFunction { + private fun generateFunctionDeclaration(ktFun: KtNamedFunction): IrFunction { val funDescriptor = getOrFail(BindingContext.FUNCTION, ktFun) val irFun = IrFunctionImpl(ktFun.startOffset, ktFun.endOffset, IrDeclarationOrigin.DEFINED, funDescriptor) irFun.body = BodyGenerator(funDescriptor, statementGenerator.context).generateFunctionBody(ktFun.bodyExpression!!) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/BackingFieldLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/BackingFieldLValue.kt index f18a7f086b5..5ca7977f22a 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/BackingFieldLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/BackingFieldLValue.kt @@ -18,8 +18,8 @@ package org.jetbrains.kotlin.psi2ir.intermediate import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrGetBackingFieldImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrSetBackingFieldImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl import org.jetbrains.kotlin.types.KotlinType class BackingFieldLValue( @@ -32,10 +32,10 @@ class BackingFieldLValue( override val type: KotlinType get() = descriptor.type override fun store(irExpression: IrExpression): IrExpression = - IrSetBackingFieldImpl(startOffset, endOffset, descriptor, receiver?.load(), irExpression, operator) + IrSetFieldImpl(startOffset, endOffset, descriptor, receiver?.load(), irExpression, operator) override fun load(): IrExpression = - IrGetBackingFieldImpl(startOffset, endOffset, descriptor, receiver?.load(), operator) + IrGetFieldImpl(startOffset, endOffset, descriptor, receiver?.load(), operator) override fun assign(withLValue: (LValue) -> IrExpression): IrExpression = withLValue(this) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt index 4597b29c5c7..0aa40615eb1 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SimplePropertyLValue.kt @@ -44,8 +44,8 @@ class SimplePropertyLValue( extensionReceiverValue?.load(), irOperator, superQualifier) - } ?: IrGetBackingFieldImpl(startOffset, endOffset, descriptor, - dispatchReceiverValue?.load(), irOperator, superQualifier) + } ?: IrGetFieldImpl(startOffset, endOffset, descriptor, + dispatchReceiverValue?.load(), irOperator, superQualifier) } override fun store(irExpression: IrExpression) = @@ -57,8 +57,8 @@ class SimplePropertyLValue( irExpression, irOperator, superQualifier) - } ?: IrSetBackingFieldImpl(startOffset, endOffset, descriptor, - dispatchReceiverValue?.load(), irExpression, irOperator, superQualifier) + } ?: IrSetFieldImpl(startOffset, endOffset, descriptor, + dispatchReceiverValue?.load(), irExpression, irOperator, superQualifier) } override fun assign(withLValue: (LValue) -> IrExpression) = diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt index cb279f825c4..b85551319ca 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt @@ -79,7 +79,7 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementVisitorVoid { expression.value.replaceWithCast(expression.descriptor.type) } - override fun visitSetBackingField(expression: IrSetBackingField) { + override fun visitSetBackingField(expression: IrSetField) { expression.acceptChildrenVoid(this) expression.value.replaceWithCast(expression.descriptor.type) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrSlots.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrSlots.kt index c75d84d1c16..76927795866 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrSlots.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrSlots.kt @@ -44,6 +44,7 @@ const val TRY_RESULT_SLOT = -13 const val FINALLY_EXPRESSION_SLOT = -14 const val PROPERTY_GETTER_SLOT = -15 const val PROPERTY_SETTER_SLOT = -16 -const val DELEGATE_SLOT = -17 +const val BACKING_FIELD_SLOT = -17 const val ENUM_ENTRY_CLASS_SLOT = -18 -const val ENUM_ENTRY_INITIALIZER_SLOT = -19 \ No newline at end of file +const val ENUM_ENTRY_INITIALIZER_SLOT = -19 +const val LOCAL_DELEGATE_SLOT = -20 \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt index 6ae2b84a820..b86760c944b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt @@ -32,10 +32,10 @@ fun IrClass.getInstanceInitializerMembers() = when (it) { is IrAnonymousInitializer -> true - is IrSimpleProperty -> + is IrProperty -> + it.backingField?.initializer != null + is IrField -> it.initializer != null - is IrDelegatedProperty -> - true else -> false } } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt index 6737ffeb4bb..ca6777a2100 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclaration.kt @@ -33,6 +33,7 @@ enum class IrDeclarationKind { FUNCTION, CONSTRUCTOR, PROPERTY, + FIELD, PROPERTY_ACCESSOR, VARIABLE, LOCAL_PROPERTY, @@ -44,6 +45,8 @@ enum class IrDeclarationKind { enum class IrDeclarationOrigin { DEFINED, + PROPERTY_BACKING_FIELD, + DEFAULT_PROPERTY_ACCESSOR, DELEGATE, DELEGATED_PROPERTY_ACCESSOR, DELEGATED_MEMBER, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrGeneralFunction.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrGeneralFunction.kt index 672d77146ae..bb8236ab1b7 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrGeneralFunction.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrGeneralFunction.kt @@ -21,15 +21,13 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.expressions.IrExpressionBody -interface IrGeneralFunction : IrDeclaration { +interface IrFunction : IrDeclaration { override val descriptor: FunctionDescriptor var body: IrBody? override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.FUNCTION -} -interface IrFunction : IrGeneralFunction { fun putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) fun getDefault(parameter: ValueParameterDescriptor): IrExpressionBody? } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrLocalDelegatedProperty.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrLocalDelegatedProperty.kt index 65556f84cab..59dc6820741 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrLocalDelegatedProperty.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrLocalDelegatedProperty.kt @@ -22,17 +22,9 @@ import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors interface IrLocalDelegatedProperty : IrDeclaration { override val descriptor: VariableDescriptorWithAccessors var delegate: IrVariable - var getter: IrLocalPropertyAccessor - var setter: IrLocalPropertyAccessor? + var getter: IrFunction + var setter: IrFunction? override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.LOCAL_PROPERTY } - -interface IrLocalPropertyAccessor : IrGeneralFunction { - override val descriptor: VariableAccessorDescriptor - - override val declarationKind: IrDeclarationKind - get() = IrDeclarationKind.LOCAL_PROPERTY_ACCESSOR -} - diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt index 81d7014b05b..d613e30b38d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrProperty.kt @@ -17,22 +17,24 @@ package org.jetbrains.kotlin.ir.declarations import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.ir.expressions.IrBody +import org.jetbrains.kotlin.ir.expressions.IrExpressionBody interface IrProperty : IrDeclaration { override val descriptor: PropertyDescriptor - var getter: IrPropertyGetter? - var setter: IrPropertySetter? + val isDelegated: Boolean + var backingField: IrField? + var getter: IrFunction? + var setter: IrFunction? override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.PROPERTY } -interface IrSimpleProperty : IrProperty { - var initializer: IrBody? -} +interface IrField : IrDeclaration { + override val descriptor: PropertyDescriptor -interface IrDelegatedProperty : IrProperty { - var delegate: IrSimpleProperty -} + override val declarationKind: IrDeclarationKind + get() = IrDeclarationKind.FIELD + var initializer: IrExpressionBody? +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrPropertyAccessor.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrPropertyAccessor.kt deleted file mode 100644 index f18455216cb..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrPropertyAccessor.kt +++ /dev/null @@ -1,39 +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.declarations - -import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor -import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor -import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor - -interface IrPropertyAccessor : IrGeneralFunction { - override val descriptor: PropertyAccessorDescriptor - - override val declarationKind: IrDeclarationKind - get() = IrDeclarationKind.PROPERTY_ACCESSOR -} - -interface IrPropertyGetter : IrPropertyAccessor { - override val descriptor: PropertyGetterDescriptor - - -} - -interface IrPropertySetter : IrPropertyAccessor { - override val descriptor: PropertySetterDescriptor -} - diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDelegatedPropertyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDelegatedPropertyImpl.kt deleted file mode 100644 index 9fa0f87253e..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDelegatedPropertyImpl.kt +++ /dev/null @@ -1,72 +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.declarations.impl - -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.ir.* -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrDelegatedProperty -import org.jetbrains.kotlin.ir.declarations.IrSimpleProperty -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor - -class IrDelegatedPropertyImpl( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - descriptor: PropertyDescriptor -) : IrPropertyBase(startOffset, endOffset, origin, descriptor), IrDelegatedProperty { - constructor( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - descriptor: PropertyDescriptor, - delegate: IrSimpleProperty - ) : this(startOffset, endOffset, origin, descriptor) { - this.delegate = delegate - } - - private var delegateImpl: IrSimpleProperty? = null - override var delegate: IrSimpleProperty - get() = delegateImpl!! - set(value) { - delegateImpl?.detach() - delegateImpl = value - value.setTreeLocation(this, DELEGATE_SLOT) - } - - override fun getChild(slot: Int): IrElement? = - when (slot) { - DELEGATE_SLOT -> delegate - else -> super.getChild(slot) - } - - override fun replaceChild(slot: Int, newChild: IrElement) { - when (slot) { - DELEGATE_SLOT -> delegate = newChild.assertCast() - else -> super.replaceChild(slot, newChild) - } - } - - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitDelegatedProperty(this, data) - - override fun acceptChildren(visitor: IrElementVisitor, data: D) { - delegate.accept(visitor, data) - getter?.accept(visitor, data) - setter?.accept(visitor, data) - } -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrSimplePropertyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFieldImpl.kt similarity index 69% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrSimplePropertyImpl.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFieldImpl.kt index 3be639bb5dc..7ef8f50c9de 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrSimplePropertyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFieldImpl.kt @@ -19,18 +19,24 @@ package org.jetbrains.kotlin.ir.declarations.impl import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.* import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrSimpleProperty -import org.jetbrains.kotlin.ir.expressions.IrBody +import org.jetbrains.kotlin.ir.declarations.IrField +import org.jetbrains.kotlin.ir.expressions.IrExpressionBody import org.jetbrains.kotlin.ir.visitors.IrElementVisitor -class IrSimplePropertyImpl( + +class IrFieldImpl( startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, - descriptor: PropertyDescriptor, - valueInitializer: IrBody? = null -) : IrPropertyBase(startOffset, endOffset, origin, descriptor), IrSimpleProperty { - override var initializer: IrBody? = valueInitializer + override val descriptor: PropertyDescriptor +): IrDeclarationBase(startOffset, endOffset, origin), IrField { + constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: PropertyDescriptor, + initializer: IrExpressionBody? + ) : this(startOffset, endOffset, origin, descriptor) { + this.initializer = initializer + } + + override var initializer: IrExpressionBody? = null set(value) { field?.detach() field = value @@ -40,22 +46,21 @@ class IrSimplePropertyImpl( override fun getChild(slot: Int): IrElement? = when (slot) { INITIALIZER_SLOT -> initializer - else -> super.getChild(slot) + else -> null } override fun replaceChild(slot: Int, newChild: IrElement) { when (slot) { INITIALIZER_SLOT -> initializer = newChild.assertCast() - else -> super.replaceChild(slot, newChild) + else -> throwNoSuchSlot(slot) } } - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitSimpleProperty(this, data) + override fun accept(visitor: IrElementVisitor, data: D): R { + return visitor.visitField(this, data) + } override fun acceptChildren(visitor: IrElementVisitor, data: D) { initializer?.accept(visitor, data) - getter?.accept(visitor, data) - setter?.accept(visitor, data) } } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrGeneralFunctionBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrGeneralFunctionBase.kt index 30be3ee43e5..601c8d0abc8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrGeneralFunctionBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrGeneralFunctionBase.kt @@ -18,8 +18,7 @@ package org.jetbrains.kotlin.ir.declarations.impl import org.jetbrains.kotlin.ir.* import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrGeneralFunction -import org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase +import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.visitors.IrElementVisitor @@ -27,16 +26,7 @@ abstract class IrGeneralFunctionBase( startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin -) : IrDeclarationBase(startOffset, endOffset, origin), IrGeneralFunction { - constructor( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - body: IrBody - ) : this(startOffset, endOffset, origin) { - this.body = body - } - +) : IrDeclarationBase(startOffset, endOffset, origin), IrFunction { final override var body: IrBody? = null set(newValue) { field?.detach() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalDelegatedPropertyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalDelegatedPropertyImpl.kt index 82134352b14..3d97ac38765 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalDelegatedPropertyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalDelegatedPropertyImpl.kt @@ -18,10 +18,7 @@ package org.jetbrains.kotlin.ir.declarations.impl import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors import org.jetbrains.kotlin.ir.* -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrLocalDelegatedProperty -import org.jetbrains.kotlin.ir.declarations.IrLocalPropertyAccessor -import org.jetbrains.kotlin.ir.declarations.IrVariable +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase import org.jetbrains.kotlin.ir.visitors.IrElementVisitor @@ -47,11 +44,11 @@ class IrLocalDelegatedPropertyImpl( set(value) { delegateImpl?.detach() delegateImpl = value - value.setTreeLocation(this, DELEGATE_SLOT) + value.setTreeLocation(this, LOCAL_DELEGATE_SLOT) } - private var getterImpl: IrLocalPropertyAccessor? = null - override var getter: IrLocalPropertyAccessor + private var getterImpl: IrFunction? = null + override var getter: IrFunction get() = getterImpl!! set(value) { getterImpl?.detach() @@ -59,7 +56,7 @@ class IrLocalDelegatedPropertyImpl( value.setTreeLocation(this, PROPERTY_GETTER_SLOT) } - override var setter: IrLocalPropertyAccessor? = null + override var setter: IrFunction? = null set(value) { field?.detach() field = value @@ -68,7 +65,7 @@ class IrLocalDelegatedPropertyImpl( override fun getChild(slot: Int): IrElement? = when (slot) { - DELEGATE_SLOT -> delegate + LOCAL_DELEGATE_SLOT -> delegate PROPERTY_GETTER_SLOT -> getter PROPERTY_SETTER_SLOT -> setter else -> null @@ -76,7 +73,7 @@ class IrLocalDelegatedPropertyImpl( override fun replaceChild(slot: Int, newChild: IrElement) { when (slot) { - DELEGATE_SLOT -> delegate = newChild.assertCast() + LOCAL_DELEGATE_SLOT -> delegate = newChild.assertCast() PROPERTY_GETTER_SLOT -> getter = newChild.assertCast() PROPERTY_SETTER_SLOT -> setter = newChild.assertCast() else -> throwNoSuchSlot(slot) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalPropertyAccessorImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalPropertyAccessorImpl.kt deleted file mode 100644 index c60c629ac20..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrLocalPropertyAccessorImpl.kt +++ /dev/null @@ -1,44 +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.declarations.impl - -import org.jetbrains.kotlin.descriptors.VariableAccessorDescriptor -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrLocalPropertyAccessor -import org.jetbrains.kotlin.ir.expressions.IrBody -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor - -class IrLocalPropertyAccessorImpl( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - override val descriptor: VariableAccessorDescriptor -) : IrGeneralFunctionBase(startOffset, endOffset, origin), IrLocalPropertyAccessor { - constructor( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - descriptor: VariableAccessorDescriptor, - body: IrBody - ) : this(startOffset, endOffset, origin, descriptor) { - this.body = body - } - - override fun accept(visitor: IrElementVisitor, data: D): R { - return visitor.visitLocalPropertyAccessor(this, data) - } -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyAccessorBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyAccessorBase.kt deleted file mode 100644 index c78f997adfe..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyAccessorBase.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.declarations.impl - -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrPropertyAccessor - -abstract class IrPropertyAccessorBase( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin -) : IrGeneralFunctionBase(startOffset, endOffset, origin), IrPropertyAccessor \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyBase.kt deleted file mode 100644 index f3e78fc0be5..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyBase.kt +++ /dev/null @@ -1,61 +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.declarations.impl - -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.ir.* -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrProperty -import org.jetbrains.kotlin.ir.declarations.IrPropertyGetter -import org.jetbrains.kotlin.ir.declarations.IrPropertySetter -import org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase - -abstract class IrPropertyBase( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - override val descriptor: PropertyDescriptor -) : IrDeclarationBase(startOffset, endOffset, origin), IrProperty { - override var getter: IrPropertyGetter? = null - set(newGetter) { - field?.detach() - field = newGetter - newGetter?.setTreeLocation(this, PROPERTY_GETTER_SLOT) - } - - override var setter: IrPropertySetter? = null - set(newSetter) { - field?.detach() - field = newSetter - newSetter?.setTreeLocation(this, PROPERTY_SETTER_SLOT) - } - - override fun getChild(slot: Int): IrElement? = - when (slot) { - PROPERTY_GETTER_SLOT -> getter - PROPERTY_SETTER_SLOT -> setter - else -> null - } - - override fun replaceChild(slot: Int, newChild: IrElement) { - when (slot) { - PROPERTY_GETTER_SLOT -> getter = newChild.assertCast() - PROPERTY_SETTER_SLOT -> setter = newChild.assertCast() - else -> throwNoSuchSlot(slot) - } - } -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyGetterImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyGetterImpl.kt deleted file mode 100644 index 0c5e0efd7b4..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyGetterImpl.kt +++ /dev/null @@ -1,43 +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.declarations.impl - -import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrPropertyGetter -import org.jetbrains.kotlin.ir.expressions.IrBody -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor - -class IrPropertyGetterImpl( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - override val descriptor: PropertyGetterDescriptor -) : IrPropertyAccessorBase(startOffset, endOffset, origin), IrPropertyGetter { - constructor( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - descriptor: PropertyGetterDescriptor, - body: IrBody - ) : this(startOffset, endOffset, origin, descriptor) { - this.body = body - } - - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitPropertyGetter(this, data) -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyImpl.kt new file mode 100644 index 00000000000..f777b708c17 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertyImpl.kt @@ -0,0 +1,96 @@ +/* + * 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.declarations.impl + +import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.ir.* +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrField +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrProperty +import org.jetbrains.kotlin.ir.visitors.IrElementVisitor + +class IrPropertyImpl( + startOffset: Int, + endOffset: Int, + origin: IrDeclarationOrigin, + override val isDelegated: Boolean, + override val descriptor: PropertyDescriptor +) : IrDeclarationBase(startOffset, endOffset, origin), IrProperty { + constructor( + startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, isDelegated: Boolean, descriptor: PropertyDescriptor, + backingField: IrField? + ) : this(startOffset, endOffset, origin, isDelegated, descriptor) { + this.backingField = backingField + } + + constructor( + startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, isDelegated: Boolean, descriptor: PropertyDescriptor, + backingField: IrField?, getter: IrFunction?, setter: IrFunction? + ) : this(startOffset, endOffset, origin, isDelegated, descriptor, backingField) { + this.getter = getter + this.setter = setter + } + + override var backingField: IrField? = null + set(value) { + field?.detach() + field = value + value?.setTreeLocation(this, BACKING_FIELD_SLOT) + } + + override var getter: IrFunction? = null + set(value) { + field?.detach() + field = value + value?.setTreeLocation(this, PROPERTY_GETTER_SLOT) + } + + override var setter: IrFunction? = null + set(value) { + field?.detach() + field = value + value?.setTreeLocation(this, PROPERTY_SETTER_SLOT) + } + + override fun getChild(slot: Int): IrElement? = + when (slot) { + BACKING_FIELD_SLOT -> backingField + PROPERTY_GETTER_SLOT -> getter + PROPERTY_SETTER_SLOT -> setter + else -> null + } + + override fun replaceChild(slot: Int, newChild: IrElement) { + when (slot) { + BACKING_FIELD_SLOT -> backingField = newChild.assertCast() + PROPERTY_GETTER_SLOT -> getter = newChild.assertCast() + PROPERTY_SETTER_SLOT -> setter = newChild.assertCast() + else -> throwNoSuchSlot(slot) + } + } + + override fun accept(visitor: IrElementVisitor, data: D): R { + return visitor.visitProperty(this, data) + } + + override fun acceptChildren(visitor: IrElementVisitor, data: D) { + backingField?.accept(visitor, data) + getter?.accept(visitor, data) + setter?.accept(visitor, data) + } +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertySetterImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertySetterImpl.kt deleted file mode 100644 index 1183a093b87..00000000000 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrPropertySetterImpl.kt +++ /dev/null @@ -1,43 +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.declarations.impl - -import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrPropertySetter -import org.jetbrains.kotlin.ir.expressions.IrBody -import org.jetbrains.kotlin.ir.visitors.IrElementVisitor - -class IrPropertySetterImpl( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - override val descriptor: PropertySetterDescriptor -) : IrPropertyAccessorBase(startOffset, endOffset, origin), IrPropertySetter { - constructor( - startOffset: Int, - endOffset: Int, - origin: IrDeclarationOrigin, - descriptor: PropertySetterDescriptor, - body: IrBody - ) : this(startOffset, endOffset, origin, descriptor) { - this.body = body - } - - override fun accept(visitor: IrElementVisitor, data: D): R = - visitor.visitPropertySetter(this, data) -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBackingFieldExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFieldExpression.kt similarity index 84% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBackingFieldExpression.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFieldExpression.kt index 49daf9be601..094b5688b79 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBackingFieldExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFieldExpression.kt @@ -19,15 +19,15 @@ package org.jetbrains.kotlin.ir.expressions import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor -interface IrBackingFieldExpression : IrDeclarationReference { +interface IrFieldExpression : IrDeclarationReference { override val descriptor: PropertyDescriptor val superQualifier: ClassDescriptor? var receiver: IrExpression? val operator: IrOperator? } -interface IrGetBackingField : IrBackingFieldExpression +interface IrGetField : IrFieldExpression -interface IrSetBackingField : IrBackingFieldExpression { +interface IrSetField : IrFieldExpression { var value: IrExpression } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBackingFieldExpressionBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFieldExpressionBase.kt similarity index 91% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBackingFieldExpressionBase.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFieldExpressionBase.kt index f48a6bd6cfc..d7481ef4462 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBackingFieldExpressionBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFieldExpressionBase.kt @@ -19,19 +19,19 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.* -import org.jetbrains.kotlin.ir.expressions.IrBackingFieldExpression +import org.jetbrains.kotlin.ir.expressions.IrFieldExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrOperator import org.jetbrains.kotlin.types.KotlinType -abstract class IrBackingFieldExpressionBase( +abstract class IrFieldExpressionBase( startOffset: Int, endOffset: Int, descriptor: PropertyDescriptor, type: KotlinType, override val operator: IrOperator? = null, override val superQualifier: ClassDescriptor? = null -) : IrDeclarationReferenceBase(startOffset, endOffset, type, descriptor), IrBackingFieldExpression { +) : IrDeclarationReferenceBase(startOffset, endOffset, type, descriptor), IrFieldExpression { override final var receiver: IrExpression? = null set(value) { field?.detach() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetBackingFieldImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt similarity index 87% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetBackingFieldImpl.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt index e59e7eb2b10..149d231959a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetBackingFieldImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt @@ -20,17 +20,17 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrGetBackingField +import org.jetbrains.kotlin.ir.expressions.IrGetField import org.jetbrains.kotlin.ir.expressions.IrOperator import org.jetbrains.kotlin.ir.visitors.IrElementVisitor -class IrGetBackingFieldImpl( +class IrGetFieldImpl( startOffset: Int, endOffset: Int, descriptor: PropertyDescriptor, operator: IrOperator? = null, superQualifier: ClassDescriptor? = null -) : IrBackingFieldExpressionBase(startOffset, endOffset, descriptor, descriptor.type, operator, superQualifier), IrGetBackingField { +) : IrFieldExpressionBase(startOffset, endOffset, descriptor, descriptor.type, operator, superQualifier), IrGetField { constructor( startOffset: Int, endOffset: Int, @@ -50,7 +50,7 @@ class IrGetBackingFieldImpl( } override fun accept(visitor: IrElementVisitor, data: D): R { - return visitor.visitGetBackingField(this, data) + return visitor.visitGetField(this, data) } override fun acceptChildren(visitor: IrElementVisitor, data: D) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetBackingFieldImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt similarity index 87% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetBackingFieldImpl.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt index c753464d1b6..c8189bb484e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetBackingFieldImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt @@ -21,18 +21,18 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.* import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrOperator -import org.jetbrains.kotlin.ir.expressions.IrSetBackingField -import org.jetbrains.kotlin.ir.expressions.impl.IrBackingFieldExpressionBase +import org.jetbrains.kotlin.ir.expressions.IrSetField +import org.jetbrains.kotlin.ir.expressions.impl.IrFieldExpressionBase import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.types.typeUtil.builtIns -class IrSetBackingFieldImpl( +class IrSetFieldImpl( startOffset: Int, endOffset: Int, descriptor: PropertyDescriptor, operator: IrOperator? = null, superQualifier: ClassDescriptor? = null -) : IrBackingFieldExpressionBase(startOffset, endOffset, descriptor, descriptor.type.builtIns.unitType, operator, superQualifier), IrSetBackingField { +) : IrFieldExpressionBase(startOffset, endOffset, descriptor, descriptor.type.builtIns.unitType, operator, superQualifier), IrSetField { constructor( startOffset: Int, endOffset: Int, @@ -69,7 +69,7 @@ class IrSetBackingFieldImpl( } override fun accept(visitor: IrElementVisitor, data: D): R { - return visitor.visitSetBackingField(this, data) + return visitor.visitSetField(this, data) } override fun acceptChildren(visitor: IrElementVisitor, data: D) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt index ebff21fa43a..f07da2e31ea 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -72,14 +72,6 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { visitFunctionWithParameters(declaration, data) } - override fun visitDelegatedProperty(declaration: IrDelegatedProperty, data: String) { - declaration.dumpLabeledElementWith(data) { - declaration.delegate.accept(this, "delegate") - declaration.getter?.accept(this, "") - declaration.setter?.accept(this, "") - } - } - override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: String) { expression.dumpLabeledElementWith(data) { expression.explicitReceiver?.accept(this, "receiver") @@ -113,13 +105,13 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { } } - override fun visitGetBackingField(expression: IrGetBackingField, data: String) { + override fun visitGetField(expression: IrGetField, data: String) { expression.dumpLabeledElementWith(data) { expression.receiver?.accept(this, "receiver") } } - override fun visitSetBackingField(expression: IrSetBackingField, data: String) { + override fun visitSetField(expression: IrSetField, data: String) { expression.dumpLabeledElementWith(data) { expression.receiver?.accept(this, "receiver") expression.value.accept(this, "value") 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 349adea19d5..6df0085798a 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 @@ -51,11 +51,8 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitProperty(declaration: IrProperty, data: Nothing?): String = "PROPERTY ${declaration.renderDeclared()}" - override fun visitPropertyGetter(declaration: IrPropertyGetter, data: Nothing?): String = - "PROPERTY_GETTER ${declaration.renderDeclared()}" - - override fun visitPropertySetter(declaration: IrPropertySetter, data: Nothing?): String = - "PROPERTY_SETTER ${declaration.renderDeclared()}" + override fun visitField(declaration: IrField, data: Nothing?): String = + "FIELD ${declaration.renderDeclared()}" override fun visitClass(declaration: IrClass, data: Nothing?): String = "CLASS ${declaration.descriptor.kind} ${declaration.descriptor.ref()}" @@ -75,9 +72,6 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: Nothing?): String = "LOCAL_DELEGATED_PROPERTY ${declaration.renderDeclared()}" - override fun visitLocalPropertyAccessor(declaration: IrLocalPropertyAccessor, data: Nothing?): String = - "LOCAL_PROPERTY_ACCESSOR ${declaration.descriptor.ref()}" // can't render, see nullability for modality - override fun visitExpressionBody(body: IrExpressionBody, data: Nothing?): String = "EXPRESSION_BODY" @@ -140,10 +134,10 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitSetVariable(expression: IrSetVariable, data: Nothing?): String = "SET_VAR '${expression.descriptor.ref()}' type=${expression.type.render()} operator=${expression.operator}" - override fun visitGetBackingField(expression: IrGetBackingField, data: Nothing?): String = + override fun visitGetField(expression: IrGetField, data: Nothing?): String = "GET_BACKING_FIELD '${expression.descriptor.ref()}' type=${expression.type.render()} operator=${expression.operator}" - override fun visitSetBackingField(expression: IrSetBackingField, data: Nothing?): String = + override fun visitSetField(expression: IrSetField, data: Nothing?): String = "SET_BACKING_FIELD '${expression.descriptor.ref()}' type=${expression.type.render()} operator=${expression.operator}" override fun visitGetObjectValue(expression: IrGetObjectValue, data: Nothing?): String = 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 1227046cedf..63e6f0e27e2 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 @@ -28,16 +28,11 @@ interface IrElementVisitor { fun visitDeclaration(declaration: IrDeclaration, data: D) = visitElement(declaration, data) fun visitClass(declaration: IrClass, data: D) = visitDeclaration(declaration, data) fun visitTypeAlias(declaration: IrTypeAlias, data: D) = visitDeclaration(declaration, data) - fun visitGeneralFunction(declaration: IrGeneralFunction, data: D) = visitDeclaration(declaration, data) - fun visitFunction(declaration: IrFunction, data: D) = visitGeneralFunction(declaration, data) - fun visitPropertyGetter(declaration: IrPropertyGetter, data: D) = visitGeneralFunction(declaration, data) - fun visitPropertySetter(declaration: IrPropertySetter, data: D) = visitGeneralFunction(declaration, data) - fun visitConstructor(declaration: IrConstructor, data: D) = visitGeneralFunction(declaration, data) + fun visitFunction(declaration: IrFunction, data: D) = visitDeclaration(declaration, data) + fun visitConstructor(declaration: IrConstructor, data: D) = visitFunction(declaration, data) fun visitProperty(declaration: IrProperty, data: D) = visitDeclaration(declaration, data) - fun visitSimpleProperty(declaration: IrSimpleProperty, data: D) = visitProperty(declaration, data) - fun visitDelegatedProperty(declaration: IrDelegatedProperty, data: D) = visitProperty(declaration, data) + fun visitField(declaration: IrField, data: D) = visitDeclaration(declaration, data) fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: D) = visitDeclaration(declaration, data) - fun visitLocalPropertyAccessor(declaration: IrLocalPropertyAccessor, data: D) = visitGeneralFunction(declaration, data) fun visitVariable(declaration: IrVariable, data: D) = visitDeclaration(declaration, data) fun visitEnumEntry(declaration: IrEnumEntry, data: D) = visitDeclaration(declaration, data) fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: D) = visitDeclaration(declaration, data) @@ -65,9 +60,9 @@ interface IrElementVisitor { 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 visitBackingFieldReference(expression: IrBackingFieldExpression, data: D) = visitDeclarationReference(expression, data) - fun visitGetBackingField(expression: IrGetBackingField, data: D) = visitBackingFieldReference(expression, data) - fun visitSetBackingField(expression: IrSetBackingField, data: D) = visitBackingFieldReference(expression, data) + fun visitBackingFieldReference(expression: IrFieldExpression, data: D) = visitDeclarationReference(expression, data) + fun visitGetField(expression: IrGetField, data: D) = visitBackingFieldReference(expression, data) + fun visitSetField(expression: IrSetField, data: D) = visitBackingFieldReference(expression, data) fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: D) = visitDeclarationReference(expression, data) fun visitGeneralCall(expression: IrGeneralCall, data: D) = visitDeclarationReference(expression, data) fun visitCall(expression: IrCall, data: D) = visitGeneralCall(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 46b6edf4ff1..189e8cab6c6 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 @@ -39,36 +39,21 @@ interface IrElementVisitorVoid : IrElementVisitor { fun visitTypeAlias(declaration: IrTypeAlias) = visitDeclaration(declaration) override fun visitTypeAlias(declaration: IrTypeAlias, data: Nothing?) = visitTypeAlias(declaration) - fun visitGeneralFunction(declaration: IrGeneralFunction) = visitDeclaration(declaration) - override fun visitGeneralFunction(declaration: IrGeneralFunction, data: Nothing?) = visitGeneralFunction(declaration) - - fun visitFunction(declaration: IrFunction) = visitGeneralFunction(declaration) + fun visitFunction(declaration: IrFunction) = visitDeclaration(declaration) override fun visitFunction(declaration: IrFunction, data: Nothing?) = visitFunction(declaration) - fun visitPropertyGetter(declaration: IrPropertyGetter) = visitGeneralFunction(declaration) - override fun visitPropertyGetter(declaration: IrPropertyGetter, data: Nothing?) = visitPropertyGetter(declaration) - - fun visitPropertySetter(declaration: IrPropertySetter) = visitGeneralFunction(declaration) - override fun visitPropertySetter(declaration: IrPropertySetter, data: Nothing?) = visitPropertySetter(declaration) - - fun visitConstructor(declaration: IrConstructor) = visitGeneralFunction(declaration) + fun visitConstructor(declaration: IrConstructor) = visitFunction(declaration) override fun visitConstructor(declaration: IrConstructor, data: Nothing?) = visitConstructor(declaration) fun visitProperty(declaration: IrProperty) = visitDeclaration(declaration) override fun visitProperty(declaration: IrProperty, data: Nothing?) = visitProperty(declaration) - fun visitSimpleProperty(declaration: IrSimpleProperty) = visitProperty(declaration) - override fun visitSimpleProperty(declaration: IrSimpleProperty, data: Nothing?) = visitSimpleProperty(declaration) - - fun visitDelegatedProperty(declaration: IrDelegatedProperty) = visitProperty(declaration) - override fun visitDelegatedProperty(declaration: IrDelegatedProperty, data: Nothing?) = visitDelegatedProperty(declaration) + fun visitField(declaration: IrField) = visitDeclaration(declaration) + override fun visitField(declaration: IrField, data: Nothing?) = visitField(declaration) fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) = visitDeclaration(declaration) override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty, data: Nothing?) = visitLocalDelegatedProperty(declaration) - fun visitLocalPropertyAccessor(declaration: IrLocalPropertyAccessor) = visitGeneralFunction(declaration) - override fun visitLocalPropertyAccessor(declaration: IrLocalPropertyAccessor, data: Nothing?) = visitLocalPropertyAccessor(declaration) - fun visitVariable(declaration: IrVariable) = visitDeclaration(declaration) override fun visitVariable(declaration: IrVariable, data: Nothing?) = visitVariable(declaration) @@ -138,14 +123,14 @@ interface IrElementVisitorVoid : IrElementVisitor { fun visitSetVariable(expression: IrSetVariable) = visitVariableAccess(expression) override fun visitSetVariable(expression: IrSetVariable, data: Nothing?) = visitSetVariable(expression) - fun visitBackingFieldReference(expression: IrBackingFieldExpression) = visitDeclarationReference(expression) - override fun visitBackingFieldReference(expression: IrBackingFieldExpression, data: Nothing?) = visitBackingFieldReference(expression) + fun visitBackingFieldReference(expression: IrFieldExpression) = visitDeclarationReference(expression) + override fun visitBackingFieldReference(expression: IrFieldExpression, data: Nothing?) = visitBackingFieldReference(expression) - fun visitGetBackingField(expression: IrGetBackingField) = visitBackingFieldReference(expression) - override fun visitGetBackingField(expression: IrGetBackingField, data: Nothing?) = visitGetBackingField(expression) + fun visitGetBackingField(expression: IrGetField) = visitBackingFieldReference(expression) + override fun visitGetField(expression: IrGetField, data: Nothing?) = visitGetBackingField(expression) - fun visitSetBackingField(expression: IrSetBackingField) = visitBackingFieldReference(expression) - override fun visitSetBackingField(expression: IrSetBackingField, data: Nothing?) = visitSetBackingField(expression) + fun visitSetBackingField(expression: IrSetField) = visitBackingFieldReference(expression) + override fun visitSetField(expression: IrSetField, data: Nothing?) = visitSetBackingField(expression) fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver) = visitDeclarationReference(expression) override fun visitGetExtensionReceiver(expression: IrGetExtensionReceiver, data: Nothing?) = visitGetExtensionReceiver(expression) diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt index 0bd950aeb90..2f6c3fcf0cb 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt @@ -5,11 +5,13 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Base' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER 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 e59e9e070af..da139937548 100644 --- a/compiler/testData/ir/irText/classes/classMembers.txt +++ b/compiler/testData/ir/irText/classes/classMembers.txt @@ -7,11 +7,13 @@ FILE /classMembers.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final var z: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter z: Int = ...' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var z: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter z: Int = ...' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CONSTRUCTOR public constructor C() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor C(Int, Int, Int = ...)' @@ -19,20 +21,26 @@ FILE /classMembers.kt y: CONST Int type=kotlin.Int value='0' z: CONST Int type=kotlin.Int value='0' PROPERTY public final val property: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final val property: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'property: Int' type=kotlin.Int operator=null + receiver: THIS of 'C' type=C PROPERTY public final val propertyWithGet: kotlin.Int - PROPERTY_GETTER public final fun (): kotlin.Int + FUN public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' PROPERTY public final var propertyWithGetAndSet: kotlin.Int - PROPERTY_GETTER public final fun (): kotlin.Int + FUN public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL '(): Int' type=kotlin.Int operator=GET_PROPERTY $this: THIS of 'C' type=C - PROPERTY_SETTER public final fun (value: kotlin.Int): kotlin.Unit + FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit operator=EQ $this: THIS of 'C' type=C diff --git a/compiler/testData/ir/irText/classes/dataClasses.txt b/compiler/testData/ir/irText/classes/dataClasses.txt index 5e1d139bb9a..1addb2407e6 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.txt @@ -5,14 +5,17 @@ FILE /dataClasses.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val y: kotlin.String - EXPRESSION_BODY - GET_VAR 'value-parameter y: String' type=kotlin.String operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.String + EXPRESSION_BODY + GET_VAR 'value-parameter y: String' type=kotlin.String operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val z: kotlin.Any - EXPRESSION_BODY - GET_VAR 'value-parameter z: Any' type=kotlin.Any operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val z: kotlin.Any + EXPRESSION_BODY + GET_VAR 'value-parameter z: Any' type=kotlin.Any operator=INITIALIZE_PROPERTY_FROM_PARAMETER FUN public final operator fun component1(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): Int' diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.txt index e35ebbc166b..37e0f94f98a 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.txt @@ -31,22 +31,39 @@ FILE /delegatedImplementation.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='' PROPERTY public open override val x: kotlin.String - EXPRESSION_BODY - GET_VAR 'value-parameter x0: String' type=kotlin.String operator=null + FIELD public open override val x: kotlin.String + EXPRESSION_BODY + GET_VAR 'value-parameter x0: String' type=kotlin.String operator=null + FUN public open override fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'x: String' type=kotlin.String operator=null + receiver: THIS of '' type=otherImpl. PROPERTY public open override var y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y0: Int' type=kotlin.Int operator=null + FIELD public open override var y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y0: Int' type=kotlin.Int operator=null + FUN public open override fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'y: Int' type=kotlin.Int operator=null + receiver: THIS of '' type=otherImpl. + FUN public open override fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'y: Int' type=kotlin.Unit operator=null + receiver: THIS of '' type=otherImpl. + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null PROPERTY public open override val kotlin.Byte.z1: kotlin.Int - PROPERTY_GETTER public open override fun kotlin.Byte.(): kotlin.Int + FUN public open override fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CONST Int type=kotlin.Int value='1' PROPERTY public open override var kotlin.Byte.z2: kotlin.Int - PROPERTY_GETTER public open override fun kotlin.Byte.(): kotlin.Int + FUN public open override fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CONST Int type=kotlin.Int value='2' - PROPERTY_SETTER public open override fun kotlin.Byte.(value: kotlin.Int): kotlin.Unit + FUN public open override fun kotlin.Byte.(value: kotlin.Int): kotlin.Unit BLOCK_BODY CALL 'constructor ()' type=otherImpl. operator=OBJECT_LITERAL CLASS CLASS Test1 @@ -54,7 +71,7 @@ FILE /delegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' - PROPERTY val `Test1$IBase$delegate`: BaseImpl + FIELD val `Test1$IBase$delegate`: BaseImpl EXPRESSION_BODY GET_OBJECT 'BaseImpl' type=BaseImpl FUN public open override fun bar(): kotlin.Int @@ -78,7 +95,7 @@ FILE /delegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' - PROPERTY val `Test2$IBase$delegate`: BaseImpl + FIELD val `Test2$IBase$delegate`: BaseImpl EXPRESSION_BODY GET_OBJECT 'BaseImpl' type=BaseImpl FUN public open override fun bar(): kotlin.Int @@ -97,44 +114,44 @@ FILE /delegatedImplementation.kt CALL 'qux() on String: Unit' type=kotlin.Unit operator=null $this: GET_VAR '`Test2$IBase$delegate`: BaseImpl' type=BaseImpl operator=null $receiver: $RECEIVER of 'qux() on String: Unit' type=kotlin.String - PROPERTY val `Test2$IOther$delegate`: IOther + FIELD val `Test2$IOther$delegate`: IOther EXPRESSION_BODY CALL 'otherImpl(String, Int): IOther' type=IOther operator=null x0: CONST String type=kotlin.String value='' y0: CONST Int type=kotlin.Int value='42' PROPERTY public open override val kotlin.Byte.z1: kotlin.Int - PROPERTY_GETTER public open override fun kotlin.Byte.(): kotlin.Int + FUN public open override fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null $receiver: $RECEIVER of 'z1: Int on Byte' type=kotlin.Byte PROPERTY public open override val x: kotlin.String - PROPERTY_GETTER public open override fun (): kotlin.String + FUN public open override fun (): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL '(): String' type=kotlin.String operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null PROPERTY public open override var kotlin.Byte.z2: kotlin.Int - PROPERTY_GETTER public open override fun kotlin.Byte.(): kotlin.Int + FUN public open override fun kotlin.Byte.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null $receiver: $RECEIVER of 'z2: Int on Byte' type=kotlin.Byte - PROPERTY_SETTER public open override fun kotlin.Byte.(: kotlin.Int): kotlin.Unit + FUN public open override fun kotlin.Byte.(: kotlin.Int): kotlin.Unit BLOCK_BODY CALL '(Int) on Byte: Unit' type=kotlin.Unit operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null $receiver: $RECEIVER of 'z2: Int on Byte' type=kotlin.Byte : GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null PROPERTY public open override var y: kotlin.Int - PROPERTY_GETTER public open override fun (): kotlin.Int + FUN public open override fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL '(): Int' type=kotlin.Int operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null - PROPERTY_SETTER public open override fun (: kotlin.Int): kotlin.Unit + FUN public open override fun (: kotlin.Int): kotlin.Unit BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit operator=null $this: GET_VAR '`Test2$IOther$delegate`: IOther' type=IOther operator=null diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt index 673d0e9a105..191f70a9a71 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt @@ -16,7 +16,7 @@ FILE /delegatedImplementationWithExplicitOverride.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' - PROPERTY val `C$IFooBar$delegate`: FooBarImpl + FIELD val `C$IFooBar$delegate`: FooBarImpl EXPRESSION_BODY GET_OBJECT 'FooBarImpl' type=FooBarImpl FUN public open override fun foo(): kotlin.Unit diff --git a/compiler/testData/ir/irText/classes/enum.txt b/compiler/testData/ir/irText/classes/enum.txt index 037ed52fb0f..b89ad1c5ca2 100644 --- a/compiler/testData/ir/irText/classes/enum.txt +++ b/compiler/testData/ir/irText/classes/enum.txt @@ -18,8 +18,9 @@ FILE /enum.kt ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' super INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum2' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER ENUM_ENTRY enum entry TEST1 init: ENUM_CONSTRUCTOR_CALL 'constructor TestEnum2(Int)' TEST1 x: CONST Int type=kotlin.Int value='1' @@ -60,8 +61,9 @@ FILE /enum.kt ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' super INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum4' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER ENUM_ENTRY enum entry TEST1 init: ENUM_CONSTRUCTOR_CALL 'constructor TEST1()' TEST1 class: CLASS ENUM_ENTRY TEST1 @@ -83,6 +85,12 @@ FILE /enum.kt x: CONST Int type=kotlin.Int value='2' INSTANCE_INITIALIZER_CALL classDescriptor='TEST2' PROPERTY public final val z: kotlin.Int + FIELD public final val z: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'z: Int' type=kotlin.Int operator=null + receiver: THIS of 'TEST2' type=TestEnum4.TEST2 ANONYMOUS_INITIALIZER TEST2 BLOCK_BODY SET_BACKING_FIELD 'z: Int' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/initBlock.txt b/compiler/testData/ir/irText/classes/initBlock.txt index d2c3a26542b..a5563853ba3 100644 --- a/compiler/testData/ir/irText/classes/initBlock.txt +++ b/compiler/testData/ir/irText/classes/initBlock.txt @@ -13,8 +13,9 @@ FILE /initBlock.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER ANONYMOUS_INITIALIZER Test2 BLOCK_BODY CALL 'println(): Unit' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/initVal.txt b/compiler/testData/ir/irText/classes/initVal.txt index 11f8cdbc7dc..29992f92439 100644 --- a/compiler/testData/ir/irText/classes/initVal.txt +++ b/compiler/testData/ir/irText/classes/initVal.txt @@ -5,22 +5,35 @@ FILE /initVal.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitValFromParameter' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS CLASS TestInitValInClass CONSTRUCTOR public constructor TestInitValInClass() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitValInClass' PROPERTY public final val x: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final val x: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitValInClass' type=TestInitValInClass CLASS CLASS TestInitValInInitBlock CONSTRUCTOR public constructor TestInitValInInitBlock() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitValInInitBlock' PROPERTY public final val x: kotlin.Int + FIELD public final val x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitValInInitBlock' type=TestInitValInInitBlock ANONYMOUS_INITIALIZER TestInitValInInitBlock BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/initVar.txt b/compiler/testData/ir/irText/classes/initVar.txt index 7fec0f6294e..cdd1c8c9dd5 100644 --- a/compiler/testData/ir/irText/classes/initVar.txt +++ b/compiler/testData/ir/irText/classes/initVar.txt @@ -5,22 +5,45 @@ FILE /initVar.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarFromParameter' PROPERTY public final var x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS CLASS TestInitVarInClass CONSTRUCTOR public constructor TestInitVarInClass() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarInClass' PROPERTY public final var x: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final var x: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitVarInClass' type=TestInitVarInClass + FUN public final fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=null + receiver: THIS of 'TestInitVarInClass' type=TestInitVarInClass + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null CLASS CLASS TestInitVarInInitBlock CONSTRUCTOR public constructor TestInitVarInInitBlock() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarInInitBlock' PROPERTY public final var x: kotlin.Int + FIELD public final var x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitVarInInitBlock' type=TestInitVarInInitBlock + FUN public final fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=null + receiver: THIS of 'TestInitVarInInitBlock' type=TestInitVarInInitBlock + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null ANONYMOUS_INITIALIZER TestInitVarInInitBlock BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit operator=EQ @@ -32,15 +55,27 @@ FILE /initVar.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarWithCustomSetter' PROPERTY public final var x: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' - PROPERTY_SETTER public final fun (value: kotlin.Int): kotlin.Unit + FIELD public final var x: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitVarWithCustomSetter' type=TestInitVarWithCustomSetter + FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=null CLASS CLASS TestInitVarWithCustomSetterWithExplicitCtor PROPERTY public final var x: kotlin.Int - PROPERTY_SETTER public final fun (value: kotlin.Int): kotlin.Unit + FIELD public final var x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitVarWithCustomSetterWithExplicitCtor' type=TestInitVarWithCustomSetterWithExplicitCtor + FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=null @@ -55,7 +90,13 @@ FILE /initVar.kt INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarWithCustomSetterWithExplicitCtor' CLASS CLASS TestInitVarWithCustomSetterInCtor PROPERTY public final var x: kotlin.Int - PROPERTY_SETTER public final fun (value: kotlin.Int): kotlin.Unit + FIELD public final var x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitVarWithCustomSetterInCtor' type=TestInitVarWithCustomSetterInCtor + FUN public final fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt index 939948c6b1b..29dc9345edd 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt @@ -2,27 +2,37 @@ FILE /objectLiteralExpressions.kt CLASS INTERFACE IFoo FUN public abstract fun foo(): kotlin.Unit PROPERTY public val test1: kotlin.Any - EXPRESSION_BODY - BLOCK type=test1. operator=OBJECT_LITERAL - CLASS CLASS - CONSTRUCTOR public constructor () - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' - INSTANCE_INITIALIZER_CALL classDescriptor='' - CALL 'constructor ()' type=test1. operator=OBJECT_LITERAL + FIELD public val test1: kotlin.Any + EXPRESSION_BODY + BLOCK type=test1. operator=OBJECT_LITERAL + CLASS CLASS + CONSTRUCTOR public constructor () + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='' + CALL 'constructor ()' type=test1. operator=OBJECT_LITERAL + FUN public fun (): kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Any' + GET_BACKING_FIELD 'test1: Any' type=kotlin.Any operator=null PROPERTY public val test2: IFoo - EXPRESSION_BODY - BLOCK type=test2. operator=OBJECT_LITERAL - CLASS CLASS - CONSTRUCTOR public constructor () - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' - INSTANCE_INITIALIZER_CALL classDescriptor='' - FUN public open override fun foo(): kotlin.Unit - BLOCK_BODY - CALL 'println(Any?): Unit' type=kotlin.Unit operator=null - message: CONST String type=kotlin.String value='foo' - CALL 'constructor ()' type=test2. operator=OBJECT_LITERAL + FIELD public val test2: IFoo + EXPRESSION_BODY + BLOCK type=test2. operator=OBJECT_LITERAL + CLASS CLASS + CONSTRUCTOR public constructor () + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='' + FUN public open override fun foo(): kotlin.Unit + BLOCK_BODY + CALL 'println(Any?): Unit' type=kotlin.Unit operator=null + message: CONST String type=kotlin.String value='foo' + CALL 'constructor ()' type=test2. operator=OBJECT_LITERAL + FUN public fun (): IFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): IFoo' + GET_BACKING_FIELD 'test2: IFoo' type=IFoo operator=null CLASS CLASS Outer CONSTRUCTOR public constructor Outer() BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.txt index ce8e2233f07..e48c7a68e00 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.txt @@ -10,9 +10,21 @@ FILE /objectWithInitializers.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='Test' PROPERTY public final val x: kotlin.Int = 1 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='1' + FIELD public final val x: kotlin.Int = 1 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='1' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'Test' type=Test PROPERTY public final val y: kotlin.Int + FIELD public final val y: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'y: Int' type=kotlin.Int operator=null + receiver: THIS of 'Test' type=Test ANONYMOUS_INITIALIZER Test BLOCK_BODY SET_BACKING_FIELD 'y: Int' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.txt b/compiler/testData/ir/irText/classes/primaryConstructor.txt index 760acbdae23..1e0d0205c59 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.txt @@ -5,31 +5,47 @@ FILE /primaryConstructor.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(x: kotlin.Int, y: kotlin.Int) BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=null + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=null + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'Test2' type=Test2 CLASS CLASS Test3 CONSTRUCTOR public constructor Test3(x: kotlin.Int, y: kotlin.Int) BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test3' PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val x: kotlin.Int + FIELD public final val x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'Test3' type=Test3 ANONYMOUS_INITIALIZER Test3 BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt index 85b22beb76c..ec7276fbb62 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt @@ -20,11 +20,13 @@ FILE /primaryConstructorWithSuperConstructorCall.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='TestWithDelegatingConstructor' PROPERTY public final val x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val y: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val y: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER 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 68f40afd693..6b05d3c5cc5 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt @@ -3,7 +3,7 @@ FILE /qualifiedSuperCalls.kt FUN public open fun foo(): kotlin.Unit BLOCK_BODY PROPERTY public open val bar: kotlin.Int - PROPERTY_GETTER public open fun (): kotlin.Int + FUN public open fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='1' @@ -11,7 +11,7 @@ FILE /qualifiedSuperCalls.kt FUN public open fun foo(): kotlin.Unit BLOCK_BODY PROPERTY public open val bar: kotlin.Int - PROPERTY_GETTER public open fun (): kotlin.Int + FUN public open fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='2' @@ -27,7 +27,7 @@ FILE /qualifiedSuperCalls.kt CALL 'foo(): Unit' superQualifier=IRight type=kotlin.Unit operator=null $this: THIS of 'CBoth' type=IRight PROPERTY public open override val bar: kotlin.Int - PROPERTY_GETTER public open override fun (): kotlin.Int + FUN public open override fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'plus(Int): Int' type=kotlin.Int operator=PLUS diff --git a/compiler/testData/ir/irText/classes/sealedClasses.txt b/compiler/testData/ir/irText/classes/sealedClasses.txt index b46f90a4428..f96fc7eb82e 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.txt @@ -10,19 +10,22 @@ FILE /sealedClasses.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Expr()' INSTANCE_INITIALIZER_CALL classDescriptor='Const' PROPERTY public final val number: kotlin.Double - EXPRESSION_BODY - GET_VAR 'value-parameter number: Double' type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val number: kotlin.Double + EXPRESSION_BODY + GET_VAR 'value-parameter number: Double' type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS CLASS Sum CONSTRUCTOR public constructor Sum(e1: Expr, e2: Expr) BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Expr()' INSTANCE_INITIALIZER_CALL classDescriptor='Sum' PROPERTY public final val e1: Expr - EXPRESSION_BODY - GET_VAR 'value-parameter e1: Expr' type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val e1: Expr + EXPRESSION_BODY + GET_VAR 'value-parameter e1: Expr' type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val e2: Expr - EXPRESSION_BODY - GET_VAR 'value-parameter e2: Expr' type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val e2: Expr + EXPRESSION_BODY + GET_VAR 'value-parameter e2: Expr' type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER 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 03232cb763a..31d3b91d00a 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt @@ -6,14 +6,26 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt INSTANCE_INITIALIZER_CALL classDescriptor='Base' CLASS CLASS TestProperty PROPERTY public final val x: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final val x: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestProperty' type=TestProperty CONSTRUCTOR public constructor TestProperty() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='TestProperty' CLASS CLASS TestInitBlock PROPERTY public final val x: kotlin.Int + FIELD public final val x: kotlin.Int + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestInitBlock' type=TestInitBlock ANONYMOUS_INITIALIZER TestInitBlock BLOCK_BODY SET_BACKING_FIELD 'x: Int' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/classes/superCalls.txt b/compiler/testData/ir/irText/classes/superCalls.txt index cd6b62c3190..be5cd93621d 100644 --- a/compiler/testData/ir/irText/classes/superCalls.txt +++ b/compiler/testData/ir/irText/classes/superCalls.txt @@ -7,8 +7,14 @@ FILE /superCalls.kt FUN public open fun foo(): kotlin.Unit BLOCK_BODY PROPERTY public open val bar: kotlin.String = "" - EXPRESSION_BODY - CONST String type=kotlin.String value='' + FIELD public open val bar: kotlin.String = "" + EXPRESSION_BODY + CONST String type=kotlin.String value='' + FUN public open fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'bar: String' type=kotlin.String operator=null + receiver: THIS of 'Base' type=Base CLASS CLASS Derived CONSTRUCTOR public constructor Derived() BLOCK_BODY @@ -19,7 +25,7 @@ FILE /superCalls.kt CALL 'foo(): Unit' superQualifier=Base type=kotlin.Unit operator=null $this: THIS of 'Derived' type=Base PROPERTY public open override val bar: kotlin.String - PROPERTY_GETTER public open override fun (): kotlin.String + FUN public open override fun (): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL '(): String' superQualifier=Base type=kotlin.String operator=GET_PROPERTY diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.txt index 4b750faf555..d5487cdcf2c 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.txt @@ -1,6 +1,6 @@ FILE /delegatedProperties.kt PROPERTY public val test1: kotlin.Int - delegate: PROPERTY val `test1$delegate`: kotlin.Lazy + FIELD val `test1$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy operator=null initializer: BLOCK type=() -> kotlin.Int operator=LAMBDA @@ -9,7 +9,7 @@ FILE /delegatedProperties.kt RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int operator=LAMBDA - PROPERTY_GETTER public fun (): kotlin.Int + FUN public fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int operator=null @@ -22,10 +22,11 @@ FILE /delegatedProperties.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' PROPERTY public final val map: kotlin.collections.MutableMap - EXPRESSION_BODY - GET_VAR 'value-parameter map: MutableMap' type=kotlin.collections.MutableMap operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val map: kotlin.collections.MutableMap + EXPRESSION_BODY + GET_VAR 'value-parameter map: MutableMap' type=kotlin.collections.MutableMap operator=INITIALIZE_PROPERTY_FROM_PARAMETER PROPERTY public final val test2: kotlin.Int - delegate: PROPERTY val `test2$delegate`: kotlin.Lazy + FIELD val `test2$delegate`: kotlin.Lazy EXPRESSION_BODY CALL 'lazy(() -> Int): Lazy' type=kotlin.Lazy operator=null initializer: BLOCK type=() -> kotlin.Int operator=LAMBDA @@ -34,7 +35,7 @@ FILE /delegatedProperties.kt RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int operator=LAMBDA - PROPERTY_GETTER public final fun (): kotlin.Int + FUN public final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int operator=null @@ -43,11 +44,11 @@ FILE /delegatedProperties.kt thisRef: THIS of 'C' type=C property: CALLABLE_REFERENCE 'test2: Int' type=kotlin.reflect.KProperty1 operator=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY public final var test3: kotlin.Any - delegate: PROPERTY val `test3$delegate`: kotlin.collections.MutableMap + FIELD val `test3$delegate`: kotlin.collections.MutableMap EXPRESSION_BODY CALL '(): MutableMap' type=kotlin.collections.MutableMap operator=GET_PROPERTY $this: THIS of 'C' type=C - PROPERTY_GETTER public final fun (): kotlin.Any + FUN public final fun (): kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Any' type=kotlin.Any operator=null @@ -55,7 +56,7 @@ FILE /delegatedProperties.kt receiver: THIS of 'C' type=C thisRef: THIS of 'C' type=C property: CALLABLE_REFERENCE 'test3: Any' type=kotlin.reflect.KMutableProperty1 operator=PROPERTY_REFERENCE_FOR_DELEGATE - PROPERTY_SETTER public final fun (: kotlin.Any): kotlin.Unit + FUN public final fun (: kotlin.Any): kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit operator=null @@ -65,17 +66,17 @@ FILE /delegatedProperties.kt property: CALLABLE_REFERENCE 'test3: Any' type=kotlin.reflect.KMutableProperty1 operator=PROPERTY_REFERENCE_FOR_DELEGATE value: GET_VAR 'value-parameter : Any' type=kotlin.Any operator=null PROPERTY public var test4: kotlin.Any - delegate: PROPERTY val `test4$delegate`: java.util.HashMap + FIELD val `test4$delegate`: java.util.HashMap EXPRESSION_BODY CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap operator=null - PROPERTY_GETTER public fun (): kotlin.Any + FUN public fun (): kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Any' type=kotlin.Any operator=null $receiver: GET_BACKING_FIELD '`test4$delegate`: HashMap' type=java.util.HashMap operator=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test4: Any' type=kotlin.reflect.KMutableProperty0 operator=PROPERTY_REFERENCE_FOR_DELEGATE - PROPERTY_SETTER public fun (: kotlin.Any): kotlin.Unit + FUN public fun (: kotlin.Any): kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/declarations/fileWithAnnotations.txt b/compiler/testData/ir/irText/declarations/fileWithAnnotations.txt index 8f3bfc84a32..e05156e49d8 100644 --- a/compiler/testData/ir/irText/declarations/fileWithAnnotations.txt +++ b/compiler/testData/ir/irText/declarations/fileWithAnnotations.txt @@ -4,5 +4,10 @@ FILE /fileWithAnnotations.kt FUN public fun foo(): kotlin.Unit BLOCK_BODY PROPERTY public val bar: kotlin.Int = 42 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='42' + FIELD public val bar: kotlin.Int = 42 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'bar: Int' type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt index 6b61819ba75..3553ef38d74 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt @@ -10,7 +10,7 @@ FILE /localDelegatedProperties.kt RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int operator=LAMBDA - LOCAL_PROPERTY_ACCESSOR (): Int + FUN local final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int operator=null @@ -24,14 +24,14 @@ FILE /localDelegatedProperties.kt LOCAL_DELEGATED_PROPERTY var x: kotlin.Int VAR val `x$delegate`: java.util.HashMap CALL 'hashMapOf(vararg Pair): HashMap' type=java.util.HashMap operator=null - LOCAL_PROPERTY_ACCESSOR (): Int + FUN local final fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Int' type=kotlin.Int operator=null $receiver: GET_VAR '`x$delegate`: HashMap' type=java.util.HashMap operator=null thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0 operator=PROPERTY_REFERENCE_FOR_DELEGATE - LOCAL_PROPERTY_ACCESSOR (Int): Int + FUN local final fun (value: kotlin.Int): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(Int): Int' TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Int diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.txt b/compiler/testData/ir/irText/errors/unresolvedReference.txt index 5f403abb512..0c436ce954c 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.txt @@ -1,15 +1,35 @@ FILE /unresolvedReference.kt PROPERTY public val test1: [ERROR : Type for unresolved] - EXPRESSION_BODY - ERROR_CALL '' type=[ERROR : ] + FIELD public val test1: [ERROR : Type for unresolved] + EXPRESSION_BODY + ERROR_CALL '' type=[ERROR : ] + FUN public fun (): [ERROR : Type for unresolved] + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): [ERROR : Type for unresolved]' + GET_BACKING_FIELD 'test1: [ERROR : Type for unresolved]' type=[ERROR : Type for unresolved] operator=null PROPERTY public val test2: [ERROR : Unresolved] - EXPRESSION_BODY - ERROR_CALL '' type=[ERROR : ] + FIELD public val test2: [ERROR : Unresolved] + EXPRESSION_BODY + ERROR_CALL '' type=[ERROR : ] + FUN public fun (): [ERROR : Unresolved] + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): [ERROR : Unresolved]' + GET_BACKING_FIELD 'test2: [ERROR : Unresolved]' type=[ERROR : Unresolved] operator=null PROPERTY public val test3: [ERROR : Type for 42.unresolved(56)] - EXPRESSION_BODY - ERROR_CALL '' type=[ERROR : ] - receiver: CONST Int type=kotlin.Int value='42' - CONST Int type=kotlin.Int value='56' + FIELD public val test3: [ERROR : Type for 42.unresolved(56)] + EXPRESSION_BODY + ERROR_CALL '' type=[ERROR : ] + receiver: CONST Int type=kotlin.Int value='42' + CONST Int type=kotlin.Int value='56' + FUN public fun (): [ERROR : Type for 42.unresolved(56)] + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): [ERROR : Type for 42.unresolved(56)]' + GET_BACKING_FIELD 'test3: [ERROR : Type for 42.unresolved(56)]' type=[ERROR : Type for 42.unresolved(56)] operator=null PROPERTY public val test4: [ERROR : Type for 42 *] - EXPRESSION_BODY - ERROR_EXPR '' type=[ERROR : ] + FIELD public val test4: [ERROR : Type for 42 *] + EXPRESSION_BODY + ERROR_EXPR '' type=[ERROR : ] + FUN public fun (): [ERROR : Type for 42 *] + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): [ERROR : Type for 42 *]' + GET_BACKING_FIELD 'test4: [ERROR : Type for 42 *]' type=[ERROR : Type for 42 *] operator=null diff --git a/compiler/testData/ir/irText/expressions/arrayAccess.txt b/compiler/testData/ir/irText/expressions/arrayAccess.txt index d7de498bd6e..233b84a1074 100644 --- a/compiler/testData/ir/irText/expressions/arrayAccess.txt +++ b/compiler/testData/ir/irText/expressions/arrayAccess.txt @@ -1,7 +1,12 @@ FILE /arrayAccess.kt PROPERTY public val p: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public val p: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'p: Int' type=kotlin.Int operator=null FUN public fun foo(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='foo(): Int' diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt index 97f02995469..db94fb88bb4 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt @@ -17,8 +17,9 @@ FILE /arrayAugmentedAssignment1.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' PROPERTY public final val x: kotlin.IntArray - EXPRESSION_BODY - GET_VAR 'value-parameter x: IntArray' type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final val x: kotlin.IntArray + EXPRESSION_BODY + GET_VAR 'value-parameter x: IntArray' type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER FUN public fun testVariable(): kotlin.Unit BLOCK_BODY VAR var x: kotlin.IntArray diff --git a/compiler/testData/ir/irText/expressions/assignments.txt b/compiler/testData/ir/irText/expressions/assignments.txt index f9a52f0c0c4..ccb7ccaa2b1 100644 --- a/compiler/testData/ir/irText/expressions/assignments.txt +++ b/compiler/testData/ir/irText/expressions/assignments.txt @@ -5,8 +5,9 @@ FILE /assignments.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Ref' PROPERTY public final var x: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER FUN public fun test1(): kotlin.Unit BLOCK_BODY VAR var x: kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt index 312e65cf6cd..a035f297e60 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt @@ -1,7 +1,16 @@ FILE /augmentedAssignment1.kt PROPERTY public var p: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public var p: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'p: Int' type=kotlin.Int operator=null + FUN public fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'p: Int' type=kotlin.Unit operator=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null FUN public fun testVariable(): kotlin.Unit BLOCK_BODY VAR var x: kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt index b82dc58c434..77c704a2462 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt @@ -15,8 +15,13 @@ FILE /augmentedAssignment2.kt FUN public operator fun A.modAssign(s: kotlin.String): kotlin.Unit BLOCK_BODY PROPERTY public val p: A - EXPRESSION_BODY - CALL 'constructor A()' type=A operator=null + FIELD public val p: A + EXPRESSION_BODY + CALL 'constructor A()' type=A operator=null + FUN public fun (): A + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): A' + GET_BACKING_FIELD 'p: A' type=A operator=null FUN public fun testVariable(): kotlin.Unit BLOCK_BODY VAR val a: A diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt index 7a445704af9..46563092c85 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt @@ -7,19 +7,40 @@ FILE /boundCallableReferences.kt FUN public final fun foo(): kotlin.Unit BLOCK_BODY PROPERTY public final val bar: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final val bar: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'bar: Int' type=kotlin.Int operator=null + receiver: THIS of 'A' type=A FUN public fun A.qux(): kotlin.Unit BLOCK_BODY PROPERTY public val test1: kotlin.reflect.KFunction0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction0 operator=null - $this: CALL 'constructor A()' type=A operator=null + FIELD public val test1: kotlin.reflect.KFunction0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction0 operator=null + $this: CALL 'constructor A()' type=A operator=null + FUN public fun (): kotlin.reflect.KFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction0' + GET_BACKING_FIELD 'test1: KFunction0' type=kotlin.reflect.KFunction0 operator=null PROPERTY public val test2: kotlin.reflect.KProperty0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'bar: Int' type=kotlin.reflect.KProperty0 operator=null - $this: CALL 'constructor A()' type=A operator=null + FIELD public val test2: kotlin.reflect.KProperty0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'bar: Int' type=kotlin.reflect.KProperty0 operator=null + $this: CALL 'constructor A()' type=A operator=null + FUN public fun (): kotlin.reflect.KProperty0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_BACKING_FIELD 'test2: KProperty0' type=kotlin.reflect.KProperty0 operator=null PROPERTY public val test3: kotlin.reflect.KFunction0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'qux() on A: Unit' type=kotlin.reflect.KFunction0 operator=null - $receiver: CALL 'constructor A()' type=A operator=null + FIELD public val test3: kotlin.reflect.KFunction0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'qux() on A: Unit' type=kotlin.reflect.KFunction0 operator=null + $receiver: CALL 'constructor A()' type=A operator=null + FUN public fun (): kotlin.reflect.KFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction0' + GET_BACKING_FIELD 'test3: KFunction0' type=kotlin.reflect.KFunction0 operator=null diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt index 57d91680e45..65ab40ad7eb 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt @@ -5,24 +5,57 @@ FILE /complexAugmentedAssignment.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='X1' PROPERTY public final var x1: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final var x1: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x1: Int' type=kotlin.Int operator=null + receiver: THIS of 'X1' type=X1 + FUN public final fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'x1: Int' type=kotlin.Unit operator=null + receiver: THIS of 'X1' type=X1 + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null CLASS OBJECT X2 CONSTRUCTOR private constructor X2() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='X2' PROPERTY public final var x2: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final var x2: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x2: Int' type=kotlin.Int operator=null + receiver: THIS of 'X2' type=X1.X2 + FUN public final fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'x2: Int' type=kotlin.Unit operator=null + receiver: THIS of 'X2' type=X1.X2 + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null CLASS OBJECT X3 CONSTRUCTOR private constructor X3() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='X3' PROPERTY public final var x3: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public final var x3: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'x3: Int' type=kotlin.Int operator=null + receiver: THIS of 'X3' type=X1.X2.X3 + FUN public final fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'x3: Int' type=kotlin.Unit operator=null + receiver: THIS of 'X3' type=X1.X2.X3 + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null FUN public fun test1(a: kotlin.IntArray): kotlin.Unit BLOCK_BODY VAR var i: kotlin.Int @@ -94,8 +127,9 @@ FILE /complexAugmentedAssignment.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='B' PROPERTY public final var s: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter s: Int = ...' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var s: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter s: Int = ...' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS OBJECT Host CONSTRUCTOR private constructor Host() BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/elvis.txt b/compiler/testData/ir/irText/expressions/elvis.txt index 3b6d1bcfcd6..b72e1296f58 100644 --- a/compiler/testData/ir/irText/expressions/elvis.txt +++ b/compiler/testData/ir/irText/expressions/elvis.txt @@ -1,7 +1,12 @@ FILE /elvis.kt PROPERTY public val p: kotlin.Any? = null - EXPRESSION_BODY - CONST Null type=kotlin.Nothing? value='null' + FIELD public val p: kotlin.Any? = null + EXPRESSION_BODY + CONST Null type=kotlin.Nothing? value='null' + FUN public fun (): kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Any?' + GET_BACKING_FIELD 'p: Any?' type=kotlin.Any? operator=null FUN public fun foo(): kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='foo(): Any?' diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt index 8f9308844fa..a06fd44a153 100644 --- a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt @@ -1,6 +1,6 @@ FILE /extensionPropertyGetterCall.kt PROPERTY public val kotlin.String.okext: kotlin.String - PROPERTY_GETTER public fun kotlin.String.(): kotlin.String + FUN public fun kotlin.String.(): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: String' CONST String type=kotlin.String value='OK' diff --git a/compiler/testData/ir/irText/expressions/field.txt b/compiler/testData/ir/irText/expressions/field.txt index 2b540d689e9..bc3bc7e842e 100644 --- a/compiler/testData/ir/irText/expressions/field.txt +++ b/compiler/testData/ir/irText/expressions/field.txt @@ -1,15 +1,25 @@ FILE /field.kt PROPERTY public var testSimple: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' - PROPERTY_SETTER public fun (value: kotlin.Int): kotlin.Unit + FIELD public var testSimple: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'testSimple: Int' type=kotlin.Int operator=null + FUN public fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_BACKING_FIELD 'testSimple: Int' type=kotlin.Unit operator=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=null PROPERTY public var testAugmented: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' - PROPERTY_SETTER public fun (value: kotlin.Int): kotlin.Unit + FIELD public var testAugmented: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'testAugmented: Int' type=kotlin.Int operator=null + FUN public fun (value: kotlin.Int): kotlin.Unit BLOCK_BODY SET_BACKING_FIELD 'testAugmented: Int' type=kotlin.Unit operator=PLUSEQ value: CALL 'plus(Int): Int' type=kotlin.Int operator=PLUSEQ diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt index be55f1341e1..1692fc10fc3 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt @@ -10,8 +10,9 @@ FILE /forWithImplicitReceivers.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='IntCell' PROPERTY public final var value: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var value: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS INTERFACE IReceiver FUN public open operator fun FiveTimes.iterator(): IntCell BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.txt index 1e24375e34a..0f70362343e 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.txt @@ -1,14 +1,28 @@ FILE /incrementDecrement.kt PROPERTY public var p: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public var p: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'p: Int' type=kotlin.Int operator=null + FUN public fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'p: Int' type=kotlin.Unit operator=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null PROPERTY public val arr: kotlin.IntArray - EXPRESSION_BODY - CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray operator=null - elements: VARARG type=IntArray varargElementType=Int - CONST Int type=kotlin.Int value='1' - CONST Int type=kotlin.Int value='2' - CONST Int type=kotlin.Int value='3' + FIELD public val arr: kotlin.IntArray + EXPRESSION_BODY + CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray operator=null + elements: VARARG type=IntArray varargElementType=Int + CONST Int type=kotlin.Int value='1' + CONST Int type=kotlin.Int value='2' + CONST Int type=kotlin.Int value='3' + FUN public fun (): kotlin.IntArray + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): IntArray' + GET_BACKING_FIELD 'arr: IntArray' type=kotlin.IntArray operator=null FUN public fun testVarPrefix(): kotlin.Unit BLOCK_BODY VAR var x: kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt index 3664b15a8aa..5746f170f2e 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt @@ -6,7 +6,7 @@ FILE /jvmStaticFieldReference.kt GET_BACKING_FIELD 'out: PrintStream!' type=java.io.PrintStream! operator=GET_PROPERTY p0: CONST String type=kotlin.String value='testFun' PROPERTY public var testProp: kotlin.Any - PROPERTY_GETTER public fun (): kotlin.Any + FUN public fun (): kotlin.Any BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit operator=null $this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream @@ -14,7 +14,7 @@ FILE /jvmStaticFieldReference.kt p0: CONST String type=kotlin.String value='testProp/get' RETURN type=kotlin.Nothing from='(): Any' CONST Int type=kotlin.Int value='42' - PROPERTY_SETTER public fun (value: kotlin.Any): kotlin.Unit + FUN public fun (value: kotlin.Any): kotlin.Unit BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit operator=null $this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream @@ -26,14 +26,20 @@ FILE /jvmStaticFieldReference.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestClass' PROPERTY public final val test: kotlin.Int - EXPRESSION_BODY - WHEN type=kotlin.Int operator=WHEN - else: BLOCK type=kotlin.Int operator=null - CALL 'println(String!): Unit' type=kotlin.Unit operator=null - $this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_BACKING_FIELD 'out: PrintStream!' type=java.io.PrintStream! operator=GET_PROPERTY - p0: CONST String type=kotlin.String value='TestClass/test' - CONST Int type=kotlin.Int value='42' + FIELD public final val test: kotlin.Int + EXPRESSION_BODY + WHEN type=kotlin.Int operator=WHEN + else: BLOCK type=kotlin.Int operator=null + CALL 'println(String!): Unit' type=kotlin.Unit operator=null + $this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + GET_BACKING_FIELD 'out: PrintStream!' type=java.io.PrintStream! operator=GET_PROPERTY + p0: CONST String type=kotlin.String value='TestClass/test' + CONST Int type=kotlin.Int value='42' + FUN public final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'test: Int' type=kotlin.Int operator=null + receiver: THIS of 'TestClass' type=TestClass ANONYMOUS_INITIALIZER TestClass BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/expressions/literals.txt b/compiler/testData/ir/irText/expressions/literals.txt index fa394fdaab4..a6a4022a312 100644 --- a/compiler/testData/ir/irText/expressions/literals.txt +++ b/compiler/testData/ir/irText/expressions/literals.txt @@ -1,52 +1,137 @@ FILE /literals.kt PROPERTY public val test1: kotlin.Int = 1 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='1' + FIELD public val test1: kotlin.Int = 1 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='1' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'test1: Int' type=kotlin.Int operator=null PROPERTY public val test2: kotlin.Int = -1 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='-1' + FIELD public val test2: kotlin.Int = -1 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='-1' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'test2: Int' type=kotlin.Int operator=null PROPERTY public val test3: kotlin.Boolean = true - EXPRESSION_BODY - CONST Boolean type=kotlin.Boolean value='true' + FIELD public val test3: kotlin.Boolean = true + EXPRESSION_BODY + CONST Boolean type=kotlin.Boolean value='true' + FUN public fun (): kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Boolean' + GET_BACKING_FIELD 'test3: Boolean' type=kotlin.Boolean operator=null PROPERTY public val test4: kotlin.Boolean = false - EXPRESSION_BODY - CONST Boolean type=kotlin.Boolean value='false' + FIELD public val test4: kotlin.Boolean = false + EXPRESSION_BODY + CONST Boolean type=kotlin.Boolean value='false' + FUN public fun (): kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Boolean' + GET_BACKING_FIELD 'test4: Boolean' type=kotlin.Boolean operator=null PROPERTY public val test5: kotlin.String = "abc" - EXPRESSION_BODY - CONST String type=kotlin.String value='abc' + FIELD public val test5: kotlin.String = "abc" + EXPRESSION_BODY + CONST String type=kotlin.String value='abc' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test5: String' type=kotlin.String operator=null PROPERTY public val test6: kotlin.Nothing? = null - EXPRESSION_BODY - CONST Null type=kotlin.Nothing? value='null' + FIELD public val test6: kotlin.Nothing? = null + EXPRESSION_BODY + CONST Null type=kotlin.Nothing? value='null' + FUN public fun (): kotlin.Nothing? + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Nothing?' + GET_BACKING_FIELD 'test6: Nothing?' type=kotlin.Nothing? operator=null PROPERTY public val test7: kotlin.Long = 1.toLong() - EXPRESSION_BODY - CONST Long type=kotlin.Long value='1' + FIELD public val test7: kotlin.Long = 1.toLong() + EXPRESSION_BODY + CONST Long type=kotlin.Long value='1' + FUN public fun (): kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Long' + GET_BACKING_FIELD 'test7: Long' type=kotlin.Long operator=null PROPERTY public val test8: kotlin.Long = -1.toLong() - EXPRESSION_BODY - CONST Long type=kotlin.Long value='-1' + FIELD public val test8: kotlin.Long = -1.toLong() + EXPRESSION_BODY + CONST Long type=kotlin.Long value='-1' + FUN public fun (): kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Long' + GET_BACKING_FIELD 'test8: Long' type=kotlin.Long operator=null PROPERTY public val test9: kotlin.Double = 1.0.toDouble() - EXPRESSION_BODY - CONST Double type=kotlin.Double value='1.0' + FIELD public val test9: kotlin.Double = 1.0.toDouble() + EXPRESSION_BODY + CONST Double type=kotlin.Double value='1.0' + FUN public fun (): kotlin.Double + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Double' + GET_BACKING_FIELD 'test9: Double' type=kotlin.Double operator=null PROPERTY public val test10: kotlin.Double = -1.0.toDouble() - EXPRESSION_BODY - CONST Double type=kotlin.Double value='-1.0' + FIELD public val test10: kotlin.Double = -1.0.toDouble() + EXPRESSION_BODY + CONST Double type=kotlin.Double value='-1.0' + FUN public fun (): kotlin.Double + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Double' + GET_BACKING_FIELD 'test10: Double' type=kotlin.Double operator=null PROPERTY public val test11: kotlin.Float = 1.0.toFloat() - EXPRESSION_BODY - CONST Float type=kotlin.Float value='1.0' + FIELD public val test11: kotlin.Float = 1.0.toFloat() + EXPRESSION_BODY + CONST Float type=kotlin.Float value='1.0' + FUN public fun (): kotlin.Float + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Float' + GET_BACKING_FIELD 'test11: Float' type=kotlin.Float operator=null PROPERTY public val test12: kotlin.Float = -1.0.toFloat() - EXPRESSION_BODY - CONST Float type=kotlin.Float value='-1.0' + FIELD public val test12: kotlin.Float = -1.0.toFloat() + EXPRESSION_BODY + CONST Float type=kotlin.Float value='-1.0' + FUN public fun (): kotlin.Float + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Float' + GET_BACKING_FIELD 'test12: Float' type=kotlin.Float operator=null PROPERTY public val test13: kotlin.Char = \u0061 ('a') - EXPRESSION_BODY - CONST Char type=kotlin.Char value='a' + FIELD public val test13: kotlin.Char = \u0061 ('a') + EXPRESSION_BODY + CONST Char type=kotlin.Char value='a' + FUN public fun (): kotlin.Char + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Char' + GET_BACKING_FIELD 'test13: Char' type=kotlin.Char operator=null PROPERTY public val testB: kotlin.Byte = 1.toByte() - EXPRESSION_BODY - CONST Byte type=kotlin.Byte value='1' + FIELD public val testB: kotlin.Byte = 1.toByte() + EXPRESSION_BODY + CONST Byte type=kotlin.Byte value='1' + FUN public fun (): kotlin.Byte + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Byte' + GET_BACKING_FIELD 'testB: Byte' type=kotlin.Byte operator=null PROPERTY public val testS: kotlin.Short = 1.toShort() - EXPRESSION_BODY - CONST Short type=kotlin.Short value='1' + FIELD public val testS: kotlin.Short = 1.toShort() + EXPRESSION_BODY + CONST Short type=kotlin.Short value='1' + FUN public fun (): kotlin.Short + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Short' + GET_BACKING_FIELD 'testS: Short' type=kotlin.Short operator=null PROPERTY public val testI: kotlin.Int = 1 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='1' + FIELD public val testI: kotlin.Int = 1 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='1' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'testI: Int' type=kotlin.Int operator=null PROPERTY public val testL: kotlin.Long = 1.toLong() - EXPRESSION_BODY - CONST Long type=kotlin.Long value='1' + FIELD public val testL: kotlin.Long = 1.toLong() + EXPRESSION_BODY + CONST Long type=kotlin.Long value='1' + FUN public fun (): kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Long' + GET_BACKING_FIELD 'testL: Long' type=kotlin.Long operator=null diff --git a/compiler/testData/ir/irText/expressions/references.txt b/compiler/testData/ir/irText/expressions/references.txt index 555255d3bb6..0215daef163 100644 --- a/compiler/testData/ir/irText/expressions/references.txt +++ b/compiler/testData/ir/irText/expressions/references.txt @@ -1,12 +1,22 @@ FILE /references.kt PROPERTY public val ok: kotlin.String = "OK" - EXPRESSION_BODY - CONST String type=kotlin.String value='OK' + FIELD public val ok: kotlin.String = "OK" + EXPRESSION_BODY + CONST String type=kotlin.String value='OK' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'ok: String' type=kotlin.String operator=null PROPERTY public val ok2: kotlin.String = "OK" - EXPRESSION_BODY - CALL '(): String' type=kotlin.String operator=GET_PROPERTY + FIELD public val ok2: kotlin.String = "OK" + EXPRESSION_BODY + CALL '(): String' type=kotlin.String operator=GET_PROPERTY + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'ok2: String' type=kotlin.String operator=null PROPERTY public val ok3: kotlin.String - PROPERTY_GETTER public fun (): kotlin.String + FUN public fun (): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CONST String type=kotlin.String value='OK' @@ -29,7 +39,7 @@ FILE /references.kt RETURN type=kotlin.Nothing from='test4(): String' CALL '(): String' type=kotlin.String operator=GET_PROPERTY PROPERTY public val kotlin.String.okext: kotlin.String - PROPERTY_GETTER public fun kotlin.String.(): kotlin.String + FUN public fun kotlin.String.(): kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: String' CONST String type=kotlin.String value='OK' diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt index d9d7a7bd037..beb8e3c6f52 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt @@ -9,28 +9,68 @@ FILE /reflectionLiterals.kt FUN public fun bar(): kotlin.Unit BLOCK_BODY PROPERTY public val qux: kotlin.Int = 42 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='42' + FIELD public val qux: kotlin.Int = 42 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'qux: Int' type=kotlin.Int operator=null PROPERTY public val test1: kotlin.reflect.KClass - EXPRESSION_BODY - CLASS_REFERENCE 'A' type=kotlin.reflect.KClass + FIELD public val test1: kotlin.reflect.KClass + EXPRESSION_BODY + CLASS_REFERENCE 'A' type=kotlin.reflect.KClass + FUN public fun (): kotlin.reflect.KClass + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KClass' + GET_BACKING_FIELD 'test1: KClass' type=kotlin.reflect.KClass operator=null PROPERTY public val test2: kotlin.reflect.KClass - EXPRESSION_BODY - GET_CLASS type=kotlin.reflect.KClass - CALL '(): Int' type=kotlin.Int operator=GET_PROPERTY + FIELD public val test2: kotlin.reflect.KClass + EXPRESSION_BODY + GET_CLASS type=kotlin.reflect.KClass + CALL '(): Int' type=kotlin.Int operator=GET_PROPERTY + FUN public fun (): kotlin.reflect.KClass + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KClass' + GET_BACKING_FIELD 'test2: KClass' type=kotlin.reflect.KClass operator=null PROPERTY public val test3: kotlin.reflect.KFunction1 - EXPRESSION_BODY - CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction1 operator=null + FIELD public val test3: kotlin.reflect.KFunction1 + EXPRESSION_BODY + CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction1 operator=null + FUN public fun (): kotlin.reflect.KFunction1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction1' + GET_BACKING_FIELD 'test3: KFunction1' type=kotlin.reflect.KFunction1 operator=null PROPERTY public val test4: kotlin.reflect.KFunction0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'constructor A()' type=kotlin.reflect.KFunction0 operator=null + FIELD public val test4: kotlin.reflect.KFunction0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'constructor A()' type=kotlin.reflect.KFunction0 operator=null + FUN public fun (): kotlin.reflect.KFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction0' + GET_BACKING_FIELD 'test4: KFunction0' type=kotlin.reflect.KFunction0 operator=null PROPERTY public val test5: kotlin.reflect.KFunction0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction0 operator=null - $this: CALL 'constructor A()' type=A operator=null + FIELD public val test5: kotlin.reflect.KFunction0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'foo(): Unit' type=kotlin.reflect.KFunction0 operator=null + $this: CALL 'constructor A()' type=A operator=null + FUN public fun (): kotlin.reflect.KFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction0' + GET_BACKING_FIELD 'test5: KFunction0' type=kotlin.reflect.KFunction0 operator=null PROPERTY public val test6: kotlin.reflect.KFunction0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'bar(): Unit' type=kotlin.reflect.KFunction0 operator=null + FIELD public val test6: kotlin.reflect.KFunction0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'bar(): Unit' type=kotlin.reflect.KFunction0 operator=null + FUN public fun (): kotlin.reflect.KFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KFunction0' + GET_BACKING_FIELD 'test6: KFunction0' type=kotlin.reflect.KFunction0 operator=null PROPERTY public val test7: kotlin.reflect.KProperty0 - EXPRESSION_BODY - CALLABLE_REFERENCE 'qux: Int' type=kotlin.reflect.KProperty0 operator=null + FIELD public val test7: kotlin.reflect.KProperty0 + EXPRESSION_BODY + CALLABLE_REFERENCE 'qux: Int' type=kotlin.reflect.KProperty0 operator=null + FUN public fun (): kotlin.reflect.KProperty0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_BACKING_FIELD 'test7: KProperty0' type=kotlin.reflect.KProperty0 operator=null diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt index 6ca385f859c..6033114b131 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt @@ -5,11 +5,11 @@ FILE /safeCallWithIncrementDecrement.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' PROPERTY public var test.C?.p: kotlin.Int - PROPERTY_GETTER public fun test.C?.(): kotlin.Int + FUN public fun test.C?.(): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='() on C?: Int' CONST Int type=kotlin.Int value='42' - PROPERTY_SETTER public fun test.C?.(value: kotlin.Int): kotlin.Unit + FUN public fun test.C?.(value: kotlin.Int): kotlin.Unit BLOCK_BODY FUN public operator fun kotlin.Int?.inc(): kotlin.Int? BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/safeCalls.txt b/compiler/testData/ir/irText/expressions/safeCalls.txt index 0ed307617cb..3a8e05a4dc5 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.txt @@ -5,8 +5,9 @@ FILE /safeCalls.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Ref' PROPERTY public final var value: kotlin.Int - EXPRESSION_BODY - GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER + FIELD public final var value: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter value: Int' type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER CLASS INTERFACE IHost FUN public open fun kotlin.String.extLength(): kotlin.Int BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/smoke.kt b/compiler/testData/ir/irText/expressions/smoke.kt index d32b7fb0bef..932babc79a1 100644 --- a/compiler/testData/ir/irText/expressions/smoke.kt +++ b/compiler/testData/ir/irText/expressions/smoke.kt @@ -8,5 +8,3 @@ var testVarWithAccessors: Int // 1 FUN public fun testFun // 1 PROPERTY public val testSimpleVal -// 2 PROPERTY_GETTER -// 1 PROPERTY_SETTER diff --git a/compiler/testData/ir/irText/expressions/smoke.txt b/compiler/testData/ir/irText/expressions/smoke.txt index 6790b485c5b..290b400050f 100644 --- a/compiler/testData/ir/irText/expressions/smoke.txt +++ b/compiler/testData/ir/irText/expressions/smoke.txt @@ -4,20 +4,34 @@ FILE /smoke.kt RETURN type=kotlin.Nothing from='testFun(): String' CONST String type=kotlin.String value='OK' PROPERTY public val testSimpleVal: kotlin.Int = 1 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='1' + FIELD public val testSimpleVal: kotlin.Int = 1 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='1' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'testSimpleVal: Int' type=kotlin.Int operator=null PROPERTY public val testValWithGetter: kotlin.Int - PROPERTY_GETTER public fun (): kotlin.Int + FUN public fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' PROPERTY public var testSimpleVar: kotlin.Int - EXPRESSION_BODY - CONST Int type=kotlin.Int value='2' + FIELD public var testSimpleVar: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='2' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'testSimpleVar: Int' type=kotlin.Int operator=null + FUN public fun (: kotlin.Int): kotlin.Unit + BLOCK_BODY + SET_BACKING_FIELD 'testSimpleVar: Int' type=kotlin.Unit operator=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int operator=null PROPERTY public var testVarWithAccessors: kotlin.Int - PROPERTY_GETTER public fun (): kotlin.Int + FUN public fun (): kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' - PROPERTY_SETTER public fun (v: kotlin.Int): kotlin.Unit + FUN public fun (v: kotlin.Int): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.txt b/compiler/testData/ir/irText/expressions/stringTemplates.txt index 16d91036b85..73aea66f2a7 100644 --- a/compiler/testData/ir/irText/expressions/stringTemplates.txt +++ b/compiler/testData/ir/irText/expressions/stringTemplates.txt @@ -4,30 +4,62 @@ FILE /stringTemplates.kt RETURN type=kotlin.Nothing from='foo(): String' CONST String type=kotlin.String value='' PROPERTY public val test1: kotlin.String = "" - EXPRESSION_BODY - CONST String type=kotlin.String value='' + FIELD public val test1: kotlin.String = "" + EXPRESSION_BODY + CONST String type=kotlin.String value='' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test1: String' type=kotlin.String operator=null PROPERTY public val test2: kotlin.String = "abc" - EXPRESSION_BODY - CONST String type=kotlin.String value='abc' + FIELD public val test2: kotlin.String = "abc" + EXPRESSION_BODY + CONST String type=kotlin.String value='abc' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test2: String' type=kotlin.String operator=null PROPERTY public val test3: kotlin.String = "" - EXPRESSION_BODY - CONST String type=kotlin.String value='' + FIELD public val test3: kotlin.String = "" + EXPRESSION_BODY + CONST String type=kotlin.String value='' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test3: String' type=kotlin.String operator=null PROPERTY public val test4: kotlin.String = "abc" - EXPRESSION_BODY - CONST String type=kotlin.String value='abc' + FIELD public val test4: kotlin.String = "abc" + EXPRESSION_BODY + CONST String type=kotlin.String value='abc' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test4: String' type=kotlin.String operator=null PROPERTY public val test5: kotlin.String = " abc " - EXPRESSION_BODY - STRING_CONCATENATION type=kotlin.String - CONST String type=kotlin.String value=' + FIELD public val test5: kotlin.String = " +abc +" + EXPRESSION_BODY + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value=' ' - CONST String type=kotlin.String value='abc' - CONST String type=kotlin.String value=' + CONST String type=kotlin.String value='abc' + CONST String type=kotlin.String value=' ' + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test5: String' type=kotlin.String operator=null PROPERTY public val test6: kotlin.String - EXPRESSION_BODY - STRING_CONCATENATION type=kotlin.String - CALL '(): String' type=kotlin.String operator=GET_PROPERTY - CONST String type=kotlin.String value=' ' - CALL 'foo(): String' type=kotlin.String operator=null + FIELD public val test6: kotlin.String + EXPRESSION_BODY + STRING_CONCATENATION type=kotlin.String + CALL '(): String' type=kotlin.String operator=GET_PROPERTY + CONST String type=kotlin.String value=' ' + CALL 'foo(): String' type=kotlin.String operator=null + FUN public fun (): kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_BACKING_FIELD 'test6: String' type=kotlin.String operator=null diff --git a/compiler/testData/ir/irText/expressions/values.txt b/compiler/testData/ir/irText/expressions/values.txt index f40ab711cfa..51c4daf7a5e 100644 --- a/compiler/testData/ir/irText/expressions/values.txt +++ b/compiler/testData/ir/irText/expressions/values.txt @@ -16,8 +16,13 @@ FILE /values.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' PROPERTY public val a: kotlin.Int = 0 - EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + FIELD public val a: kotlin.Int = 0 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_BACKING_FIELD 'a: Int' type=kotlin.Int operator=null CLASS CLASS Z CONSTRUCTOR public constructor Z() BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/vararg.txt b/compiler/testData/ir/irText/expressions/vararg.txt index a8a0d46e67d..80676878b1b 100644 --- a/compiler/testData/ir/irText/expressions/vararg.txt +++ b/compiler/testData/ir/irText/expressions/vararg.txt @@ -1,21 +1,36 @@ FILE /vararg.kt PROPERTY public val test1: kotlin.Array - EXPRESSION_BODY - CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null + FIELD public val test1: kotlin.Array + EXPRESSION_BODY + CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null + FUN public fun (): kotlin.Array + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Array' + GET_BACKING_FIELD 'test1: Array' type=kotlin.Array operator=null PROPERTY public val test2: kotlin.Array - EXPRESSION_BODY - CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null - elements: VARARG type=Array varargElementType=String - CONST String type=kotlin.String value='1' - CONST String type=kotlin.String value='2' - CONST String type=kotlin.String value='3' + FIELD public val test2: kotlin.Array + EXPRESSION_BODY + CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null + elements: VARARG type=Array varargElementType=String + CONST String type=kotlin.String value='1' + CONST String type=kotlin.String value='2' + CONST String type=kotlin.String value='3' + FUN public fun (): kotlin.Array + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Array' + GET_BACKING_FIELD 'test2: Array' type=kotlin.Array operator=null PROPERTY public val test3: kotlin.Array - EXPRESSION_BODY - CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null - elements: VARARG type=Array varargElementType=String - CONST String type=kotlin.String value='0' - SPREAD_ELEMENT - CALL '(): Array' type=kotlin.Array operator=GET_PROPERTY - SPREAD_ELEMENT - CALL '(): Array' type=kotlin.Array operator=GET_PROPERTY - CONST String type=kotlin.String value='4' + FIELD public val test3: kotlin.Array + EXPRESSION_BODY + CALL 'arrayOf(vararg String): Array' type=kotlin.Array operator=null + elements: VARARG type=Array varargElementType=String + CONST String type=kotlin.String value='0' + SPREAD_ELEMENT + CALL '(): Array' type=kotlin.Array operator=GET_PROPERTY + SPREAD_ELEMENT + CALL '(): Array' type=kotlin.Array operator=GET_PROPERTY + CONST String type=kotlin.String value='4' + FUN public fun (): kotlin.Array + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Array' + GET_BACKING_FIELD 'test3: Array' type=kotlin.Array operator=null diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.txt index cc56e821cb8..07c814eeac1 100644 --- a/compiler/testData/ir/irText/lambdas/anonymousFunction.txt +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.txt @@ -1,8 +1,13 @@ FILE /anonymousFunction.kt PROPERTY public val anonymous: () -> kotlin.Unit - EXPRESSION_BODY - BLOCK type=() -> kotlin.Unit operator=ANONYMOUS_FUNCTION - FUN local final fun (): kotlin.Unit - BLOCK_BODY - CALL 'println(): Unit' type=kotlin.Unit operator=null - CALLABLE_REFERENCE '(): Unit' type=() -> kotlin.Unit operator=ANONYMOUS_FUNCTION + FIELD public val anonymous: () -> kotlin.Unit + EXPRESSION_BODY + BLOCK type=() -> kotlin.Unit operator=ANONYMOUS_FUNCTION + FUN local final fun (): kotlin.Unit + BLOCK_BODY + CALL 'println(): Unit' type=kotlin.Unit operator=null + CALLABLE_REFERENCE '(): Unit' type=() -> kotlin.Unit operator=ANONYMOUS_FUNCTION + FUN public fun (): () -> kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): () -> Unit' + GET_BACKING_FIELD 'anonymous: () -> Unit' type=() -> kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/lambdas/justLambda.txt b/compiler/testData/ir/irText/lambdas/justLambda.txt index b94e7ee3084..18289b5a012 100644 --- a/compiler/testData/ir/irText/lambdas/justLambda.txt +++ b/compiler/testData/ir/irText/lambdas/justLambda.txt @@ -1,16 +1,26 @@ FILE /justLambda.kt PROPERTY public val test1: () -> kotlin.Int - EXPRESSION_BODY - BLOCK type=() -> kotlin.Int operator=LAMBDA - FUN local final fun (): kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Int' - CONST Int type=kotlin.Int value='42' - CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int operator=LAMBDA + FIELD public val test1: () -> kotlin.Int + EXPRESSION_BODY + BLOCK type=() -> kotlin.Int operator=LAMBDA + FUN local final fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value='42' + CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int operator=LAMBDA + FUN public fun (): () -> kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): () -> Int' + GET_BACKING_FIELD 'test1: () -> Int' type=() -> kotlin.Int operator=null PROPERTY public val test2: () -> kotlin.Unit - EXPRESSION_BODY - BLOCK type=() -> kotlin.Unit operator=LAMBDA - FUN local final fun (): kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Unit' - CALLABLE_REFERENCE '(): Unit' type=() -> kotlin.Unit operator=LAMBDA + FIELD public val test2: () -> kotlin.Unit + EXPRESSION_BODY + BLOCK type=() -> kotlin.Unit operator=LAMBDA + FUN local final fun (): kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Unit' + CALLABLE_REFERENCE '(): Unit' type=() -> kotlin.Unit operator=LAMBDA + FUN public fun (): () -> kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): () -> Unit' + GET_BACKING_FIELD 'test2: () -> Unit' type=() -> kotlin.Unit operator=null diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index c9020b2fafb..47f21512fbe 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -11,7 +11,7 @@ FILE /multipleImplicitReceivers.kt INSTANCE_INITIALIZER_CALL classDescriptor='B' CLASS INTERFACE IFoo PROPERTY public open val A.foo: B - PROPERTY_GETTER public open fun A.(): B + FUN public open fun A.(): B BLOCK_BODY RETURN type=kotlin.Nothing from='() on A: B' GET_OBJECT 'B' type=B