diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt index c0aea1d9fe4..33a44dd60fd 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt @@ -55,7 +55,7 @@ class Psi2IrTranslator(val configuration: Psi2IrConfiguration = Psi2IrConfigurat } private fun postprocess(context: GeneratorContext, irElement: IrElement) { - insertImplicitCasts(context.builtIns, irElement) + insertImplicitCasts(context.builtIns, irElement, context.symbolTable) postprocessingSteps.forEach { it.postprocess(context, irElement) } 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 04e406448b6..90d5562f198 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 @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.psi2ir.generators +import org.jetbrains.kotlin.backend.common.descriptors.substitute import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.declarations.* @@ -33,6 +34,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter +import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.utils.addToStdlib.safeAs import java.lang.AssertionError @@ -94,18 +96,17 @@ class ClassGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGe } private fun generateMembersDeclaredInSupertypeList(irClass: IrClass, ktClassOrObject: KtClassOrObject) { - ktClassOrObject.getSuperTypeList()?.let { ktSuperTypeList -> - val delegatedMembers = irClass.descriptor.unsubstitutedMemberScope - .getContributedDescriptors(DescriptorKindFilter.CALLABLES) - .filterIsInstance() - .filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION } - .sortedWith(StableDescriptorsComparator) - if (delegatedMembers.isEmpty()) return + val ktSuperTypeList = ktClassOrObject.getSuperTypeList() ?: return + val delegatedMembers = irClass.descriptor.unsubstitutedMemberScope + .getContributedDescriptors(DescriptorKindFilter.CALLABLES) + .filterIsInstance() + .filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION } + .sortedWith(StableDescriptorsComparator) + if (delegatedMembers.isEmpty()) return - for (ktEntry in ktSuperTypeList.entries) { - if (ktEntry is KtDelegatedSuperTypeEntry) { - generateDelegatedImplementationMembers(irClass, ktEntry, delegatedMembers) - } + for (ktEntry in ktSuperTypeList.entries) { + if (ktEntry is KtDelegatedSuperTypeEntry) { + generateDelegatedImplementationMembers(irClass, ktEntry, delegatedMembers) } } } @@ -139,8 +140,10 @@ class ClassGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGe } private fun generateDelegatedMember( - irClass: IrClass, irDelegate: IrField, - delegatedMember: CallableMemberDescriptor, overriddenMember: CallableMemberDescriptor + irClass: IrClass, + irDelegate: IrField, + delegatedMember: CallableMemberDescriptor, + overriddenMember: CallableMemberDescriptor ) { when (delegatedMember) { is FunctionDescriptor -> @@ -198,15 +201,22 @@ class ClassGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGe } private fun generateDelegateFunctionBody( - irDelegate: IrField, delegated: FunctionDescriptor, overridden: FunctionDescriptor, + irDelegate: IrField, + delegated: FunctionDescriptor, + overridden: FunctionDescriptor, irDelegatedFunction: IrSimpleFunction ): IrBlockBodyImpl { val startOffset = irDelegate.startOffset val endOffset = irDelegate.endOffset val irBlockBody = IrBlockBodyImpl(startOffset, endOffset) - val returnType = overridden.returnType!! - val irCall = - IrCallImpl(startOffset, endOffset, returnType, context.symbolTable.referenceFunction(overridden.original), overridden, null) + val substitutedOverridden = substituteOverriddenDescriptorForDelegate(delegated, overridden) + val returnType = substitutedOverridden.returnType!! + val irCall = IrCallImpl( + startOffset, endOffset, returnType, + context.symbolTable.referenceFunction(overridden.original), + substitutedOverridden, + null + ) irCall.dispatchReceiver = IrGetFieldImpl( startOffset, endOffset, irDelegate.symbol, @@ -230,6 +240,20 @@ class ClassGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGe return irBlockBody } + private fun substituteOverriddenDescriptorForDelegate( + delegated: FunctionDescriptor, + overridden: FunctionDescriptor + ): FunctionDescriptor { + // TODO PropertyAccessorDescriptor doesn't support 'substitute' right now :( + if (overridden is PropertyAccessorDescriptor) return overridden + + val typeArguments = HashMap() + for ((i, overriddenTypeParameter) in overridden.typeParameters.withIndex()) { + typeArguments[overriddenTypeParameter] = delegated.typeParameters[i].defaultType + } + return overridden.substitute(typeArguments) + } + private fun generateAdditionalMembersForDataClass(irClass: IrClass, ktClassOrObject: KtClassOrObject) { DataClassMembersGenerator(declarationGenerator).generate(ktClassOrObject, irClass) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt index b3f94a5f798..a96355b291b 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt @@ -135,8 +135,8 @@ class DataClassMembersGenerator(declarationGenerator: DeclarationGenerator) : De override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { buildMember(function, declaration) { +irIfThenReturnTrue(irEqeqeq(irThis(), irOther())) - +irIfThenReturnFalse(irNotIs(irOther(), classDescriptor.defaultType)) - val otherWithCast = irTemporary(irAs(irOther(), classDescriptor.defaultType), "other_with_cast") + +irIfThenReturnFalse(irNotIs(irOther(), classDescriptor.defaultType, irClass.symbol)) + val otherWithCast = irTemporary(irAs(irOther(), classDescriptor.defaultType, irClass.symbol), "other_with_cast") for (property in properties) { val arg1 = irGet(irThis(), getPropertyGetterSymbol(property)) val arg2 = irGet(irGet(otherWithCast.symbol), getPropertyGetterSymbol(property)) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt index d831bc57078..c0ae2b7dcff 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt @@ -92,7 +92,8 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat return IrTypeOperatorCallImpl( expression.startOffset, expression.endOffset, resultType, irOperator, rhsType, - expression.left.genExpr() + expression.left.genExpr(), + context.symbolTable.referenceClassifier(rhsType.constructor.declarationDescriptor!!) ) } @@ -103,7 +104,8 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat return IrTypeOperatorCallImpl( expression.startOffset, expression.endOffset, context.builtIns.booleanType, irOperator, - againstType, expression.leftHandSide.genExpr() + againstType, expression.leftHandSide.genExpr(), + context.symbolTable.referenceClassifier(againstType.constructor.declarationDescriptor!!) ) } 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 f71d4ee8965..2c04027b3e7 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 @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl +import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.psi2ir.containsNull import org.jetbrains.kotlin.types.KotlinType @@ -33,11 +34,11 @@ import org.jetbrains.kotlin.types.isNullabilityFlexible import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.upperIfFlexible -fun insertImplicitCasts(builtIns: KotlinBuiltIns, element: IrElement) { - element.transformChildren(InsertImplicitCasts(builtIns), null) +fun insertImplicitCasts(builtIns: KotlinBuiltIns, element: IrElement, symbolTable: SymbolTable) { + element.transformChildren(InsertImplicitCasts(builtIns, symbolTable), null) } -class InsertImplicitCasts(val builtIns: KotlinBuiltIns) : IrElementTransformerVoid() { +class InsertImplicitCasts(private val builtIns: KotlinBuiltIns, private val symbolTable: SymbolTable) : IrElementTransformerVoid() { override fun visitCallableReference(expression: IrCallableReference): IrExpression = expression.transformPostfix { transformReceiverArguments() @@ -175,31 +176,39 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns) : IrElementTransformerVo valueType.isNullabilityFlexible() && valueType.containsNull() && !expectedType.containsNull() -> { val nonNullValueType = valueType.upperIfFlexible().makeNotNullable() - IrTypeOperatorCallImpl( - startOffset, endOffset, nonNullValueType, - IrTypeOperator.IMPLICIT_NOTNULL, nonNullValueType, this - ).cast(expectedType) + implicitCast(nonNullValueType, IrTypeOperator.IMPLICIT_NOTNULL).cast(expectedType) } KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType.makeNotNullable(), expectedType) -> this KotlinBuiltIns.isInt(valueType) && notNullableExpectedType.isBuiltInIntegerType() -> - IrTypeOperatorCallImpl( - startOffset, endOffset, notNullableExpectedType, - IrTypeOperator.IMPLICIT_INTEGER_COERCION, notNullableExpectedType, this - ) + implicitCast(notNullableExpectedType, IrTypeOperator.IMPLICIT_INTEGER_COERCION) + + KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, expectedType) -> + this else -> { val targetType = if (!valueType.containsNull()) notNullableExpectedType else expectedType - IrTypeOperatorCallImpl( - startOffset, endOffset, targetType, - IrTypeOperator.IMPLICIT_CAST, targetType, this - ) + implicitCast(targetType, IrTypeOperator.IMPLICIT_CAST) } } } + private fun IrExpression.implicitCast( + targetType: KotlinType, + typeOperator: IrTypeOperator + ): IrExpression { + val typeDescriptor = targetType.constructor.declarationDescriptor + ?: throw AssertionError("No declaration for target type: $targetType") + + return IrTypeOperatorCallImpl( + startOffset, endOffset, + targetType, typeOperator, targetType, this, + symbolTable.referenceClassifier(typeDescriptor) + ) + } + private fun IrExpression.coerceToUnit(): IrExpression { val valueType = this.type @@ -208,7 +217,8 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns) : IrElementTransformerVo else IrTypeOperatorCallImpl( startOffset, endOffset, builtIns.unitType, - IrTypeOperator.IMPLICIT_COERCION_TO_UNIT, builtIns.unitType, this + IrTypeOperator.IMPLICIT_COERCION_TO_UNIT, builtIns.unitType, this, + symbolTable.referenceClass(builtIns.unit) ) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/ExpressionHelpers.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/ExpressionHelpers.kt index e78140d7692..4f5440b8920 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/ExpressionHelpers.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/ExpressionHelpers.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrValueSymbol import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol @@ -168,18 +169,42 @@ fun IrBuilderWithScope.irCallOp( putValueArgument(0, argument) } +@Deprecated("Creates unbound symbol") fun IrBuilderWithScope.irIs(argument: IrExpression, type: KotlinType) = IrTypeOperatorCallImpl(startOffset, endOffset, context.builtIns.booleanType, IrTypeOperator.INSTANCEOF, type, argument) +fun IrBuilderWithScope.irIs(argument: IrExpression, type: KotlinType, typeClassifier: IrClassifierSymbol) = + IrTypeOperatorCallImpl(startOffset, endOffset, context.builtIns.booleanType, IrTypeOperator.INSTANCEOF, type, argument, typeClassifier) + + +@Deprecated("Creates unbound symbol") fun IrBuilderWithScope.irNotIs(argument: IrExpression, type: KotlinType) = IrTypeOperatorCallImpl(startOffset, endOffset, context.builtIns.booleanType, IrTypeOperator.NOT_INSTANCEOF, type, argument) +fun IrBuilderWithScope.irNotIs(argument: IrExpression, type: KotlinType, typeClassifier: IrClassifierSymbol) = + IrTypeOperatorCallImpl( + startOffset, endOffset, + context.builtIns.booleanType, + IrTypeOperator.NOT_INSTANCEOF, + type, argument, typeClassifier + ) + + +@Deprecated("Creates unbound symbol") fun IrBuilderWithScope.irAs(argument: IrExpression, type: KotlinType) = IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.CAST, type, argument) +fun IrBuilderWithScope.irAs(argument: IrExpression, type: KotlinType, typeClassifier: IrClassifierSymbol) = + IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.CAST, type, argument, typeClassifier) + +@Deprecated("Creates unbound symbol") fun IrBuilderWithScope.irImplicitCast(argument: IrExpression, type: KotlinType) = IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.IMPLICIT_CAST, type, argument) +fun IrBuilderWithScope.irImplicitCast(argument: IrExpression, type: KotlinType, typeClassifier: IrClassifierSymbol) = + IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.IMPLICIT_CAST, type, argument, typeClassifier) + + fun IrBuilderWithScope.irInt(value: Int) = IrConstImpl.int(startOffset, endOffset, context.builtIns.intType, value) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt index 30a42ed868f..367cd7f0147 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.ir.expressions +import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.types.KotlinType enum class IrTypeOperator { @@ -33,5 +34,6 @@ interface IrTypeOperatorCall : IrExpression { val operator: IrTypeOperator var argument: IrExpression val typeOperand: KotlinType + val typeOperandClassifier: IrClassifierSymbol } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt index 66d7b1628ea..09d8dddde46 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt @@ -44,7 +44,7 @@ class IrClassReferenceImpl( type: KotlinType, descriptor: ClassifierDescriptor, classType: KotlinType - ) : this(startOffset, endOffset, type, createClassifierSymbolForClassReference(descriptor), classType) + ) : this(startOffset, endOffset, type, createClassifierSymbol(descriptor), classType) override val descriptor: ClassifierDescriptor get() = symbol.descriptor @@ -52,7 +52,7 @@ class IrClassReferenceImpl( visitor.visitClassReference(this, data) } -internal fun createClassifierSymbolForClassReference(descriptor: ClassifierDescriptor): IrClassifierSymbol = +internal fun createClassifierSymbol(descriptor: ClassifierDescriptor): IrClassifierSymbol = when (descriptor) { is ClassDescriptor -> IrClassSymbolImpl(descriptor) is TypeParameterDescriptor -> IrTypeParameterSymbolImpl(descriptor) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt index 5011ed3acb1..03cd3d7aa41 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall +import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.types.KotlinType @@ -30,6 +31,7 @@ class IrTypeOperatorCallImpl( override val operator: IrTypeOperator, override val typeOperand: KotlinType ) : IrExpressionBase(startOffset, endOffset, type), IrTypeOperatorCall { + @Deprecated("Creates unbound symbol") constructor( startOffset: Int, endOffset: Int, @@ -39,9 +41,28 @@ class IrTypeOperatorCallImpl( argument: IrExpression ) : this(startOffset, endOffset, type, operator, typeOperand) { this.argument = argument + + val typeOperandDescriptor = typeOperand.constructor.declarationDescriptor + if (typeOperandDescriptor != null) { + this.typeOperandClassifier = createClassifierSymbol(typeOperandDescriptor) + } + } + + constructor( + startOffset: Int, + endOffset: Int, + type: KotlinType, + operator: IrTypeOperator, + typeOperand: KotlinType, + argument: IrExpression, + typeOperandClassifier: IrClassifierSymbol + ) : this(startOffset, endOffset, type, operator, typeOperand) { + this.argument = argument + this.typeOperandClassifier = typeOperandClassifier } override lateinit var argument: IrExpression + override lateinit var typeOperandClassifier: IrClassifierSymbol override fun accept(visitor: IrElementVisitor, data: D): R = visitor.visitTypeOperator(this, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt index eeee89c9e01..0bf8f77d34b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt @@ -506,7 +506,15 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { expression.type, expression.operator, expression.typeOperand, - expression.argument.transform() + expression.argument.transform(), + run { + val oldTypeDescriptor = expression.typeOperandClassifier.descriptor + val newTypeDescriptor = mapClassifierReference(oldTypeDescriptor) + if (newTypeDescriptor == oldTypeDescriptor) + expression.typeOperandClassifier + else + createUnboundClassifierSymbol(newTypeDescriptor) + } ) override fun visitWhen(expression: IrWhen): IrWhen = diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt index cde52641130..0ccc4bc0fcf 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt @@ -437,7 +437,8 @@ open class DeepCopyIrTreeWithSymbols(private val symbolRemapper: SymbolRemapper) expression.type, expression.operator, expression.typeOperand, - expression.argument.transform() + expression.argument.transform(), + symbolRemapper.getReferencedClassifier(expression.typeOperandClassifier) ) override fun visitWhen(expression: IrWhen): IrWhen = 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 44dce9d08c1..b888c73bbbe 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 @@ -16,12 +16,10 @@ package org.jetbrains.kotlin.ir.util -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.SourceManager import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.symbols.IrBindableSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid @@ -114,11 +112,16 @@ class DumpIrTreeVisitor(out: Appendable) : IrElementVisitor { } } - private fun IrSymbol.renderDeclarationElementOrDescriptor() { + private fun IrSymbol.renderDeclarationElementOrDescriptor(label: String? = null) { if (isBound) - owner.render() - else - printer.println("UNBOUND: ", DescriptorRenderer.COMPACT.render(descriptor)) + owner.render(label) + else { + if (label != null) { + printer.println("$label: ", "UNBOUND: ", DescriptorRenderer.COMPACT.render(descriptor)) + } else { + printer.println("UNBOUND: ", DescriptorRenderer.COMPACT.render(descriptor)) + } + } } override fun visitConstructor(declaration: IrConstructor, data: String) { @@ -227,13 +230,25 @@ class DumpIrTreeVisitor(out: Appendable) : IrElementVisitor { } } + override fun visitTypeOperator(expression: IrTypeOperatorCall, data: String) { + expression.dumpLabeledElementWith(data) { + expression.typeOperandClassifier.renderDeclarationElementOrDescriptor("typeOperand") + expression.acceptChildren(this, "") + } + } + private inline fun IrElement.dumpLabeledElementWith(label: String, body: () -> Unit) { printer.println(accept(elementRenderer, null).withLabel(label)) indented(body) } - private fun IrElement.render() { - printer.println(accept(elementRenderer, null)) + private fun IrElement.render(label: String? = null) { + if (label != null) { + printer.println("$label: ", accept(elementRenderer, null)) + } else { + printer.println(accept(elementRenderer, null)) + } + } private fun IrElement.dumpLabeledSubTree(label: String) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index ac08e719c87..eae248d3bc2 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -149,10 +149,10 @@ class SymbolTable { private val fieldSymbolTable = FlatSymbolTable() private val simpleFunctionSymbolTable = FlatSymbolTable() - private val typeParameterSymbolTable = ScopedSymbolTable() + private val typeParameterSymbolTable = FlatSymbolTable() private val valueParameterSymbolTable = ScopedSymbolTable() private val variableSymbolTable = ScopedSymbolTable() - private val scopedSymbolTables = listOf(typeParameterSymbolTable, valueParameterSymbolTable, variableSymbolTable) + private val scopedSymbolTables = listOf(valueParameterSymbolTable, variableSymbolTable) fun declareFile(fileEntry: SourceManager.FileEntry, packageFragmentDescriptor: PackageFragmentDescriptor): IrFile = IrFileImpl(fileEntry, IrFileSymbolImpl(packageFragmentDescriptor)) @@ -256,7 +256,7 @@ class SymbolTable { origin: IrDeclarationOrigin, descriptor: TypeParameterDescriptor ): IrTypeParameter = - typeParameterSymbolTable.declareLocal( + typeParameterSymbolTable.declare( descriptor, { IrTypeParameterSymbolImpl(descriptor) }, { IrTypeParameterImpl(startOffset, endOffset, origin, it) } @@ -342,7 +342,9 @@ class SymbolTable { fun referenceClassifier(classifier: ClassifierDescriptor): IrClassifierSymbol = when (classifier) { is TypeParameterDescriptor -> - typeParameterSymbolTable.referenced(classifier) { throw AssertionError("Undefined type parameter referenced: $classifier") } + typeParameterSymbolTable.referenced(classifier) { + throw AssertionError("Undefined type parameter referenced: $classifier") + } is ClassDescriptor -> classSymbolTable.referenced(classifier) { IrClassSymbolImpl(classifier) } else -> diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt index 183104cd214..3f415ac1c7f 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt @@ -356,11 +356,13 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test1 flags:val TYPE_OP type=Test1 origin=CAST typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH @@ -535,11 +537,13 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test2 + typeOperand: CLASS CLASS name:Test2 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test2 flags:val TYPE_OP type=Test2 origin=CAST typeOperand=Test2 + typeOperand: CLASS CLASS name:Test2 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH @@ -641,11 +645,13 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test3 + typeOperand: CLASS CLASS name:Test3 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test3 flags:val TYPE_OP type=Test3 origin=CAST typeOperand=Test3 + typeOperand: CLASS CLASS name:Test3 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/classes/dataClasses.txt b/compiler/testData/ir/irText/classes/dataClasses.txt index d65b91bb0c4..5d55d70f9a9 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.txt @@ -143,11 +143,13 @@ FILE fqName: fileName:/dataClasses.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test1 flags:val TYPE_OP type=Test1 origin=CAST typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH @@ -268,11 +270,13 @@ FILE fqName: fileName:/dataClasses.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test2 + typeOperand: CLASS CLASS name:Test2 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test2 flags:val TYPE_OP type=Test2 origin=CAST typeOperand=Test2 + typeOperand: CLASS CLASS name:Test2 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH @@ -486,11 +490,13 @@ FILE fqName: fileName:/dataClasses.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test3 + typeOperand: CLASS CLASS name:Test3 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test3 flags:val TYPE_OP type=Test3 origin=CAST typeOperand=Test3 + typeOperand: CLASS CLASS name:Test3 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt index 677e1f660bf..797f39f8e73 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt @@ -72,6 +72,7 @@ FILE fqName: fileName:/dataClassesGeneric.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags: GET_VAR 'tmp1: T' type=T origin=null RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null @@ -91,11 +92,13 @@ FILE fqName: fileName:/dataClassesGeneric.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test1 flags:val TYPE_OP type=Test1 origin=CAST typeOperand=Test1 + typeOperand: CLASS CLASS name:Test1 modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt index d2f528881f3..9f68e6a397c 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt @@ -84,11 +84,13 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=A + typeOperand: CLASS CLASS name:A modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:A flags:val TYPE_OP type=A origin=CAST typeOperand=A + typeOperand: CLASS CLASS name:A modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH @@ -202,11 +204,13 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=B + typeOperand: CLASS CLASS name:B modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:B flags:val TYPE_OP type=B origin=CAST typeOperand=B + typeOperand: CLASS CLASS name:B modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt index 8ae9ed56537..f3e061e82da 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt @@ -48,18 +48,22 @@ FILE fqName: fileName:/localDelegatedProperties.kt property: LOCAL_DELEGATED_PROPERTY_REFERENCE 'x: Int' delegate='`x$delegate`: HashMap /* = HashMap */' getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '(Int): Unit' type=kotlin.Int origin=EQ value: CONST Int type=kotlin.Int value=0 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0 type:kotlin.Int flags:val CALL '(): Int' type=kotlin.Int origin=POSTFIX_INCR TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '(Int): Unit' type=kotlin.Int origin=POSTFIX_INCR value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR $this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null GET_VAR 'tmp0: Int' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '(Int): Unit' type=kotlin.Int origin=PLUSEQ value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ $this: CALL '(): Int' type=kotlin.Int origin=PLUSEQ diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt index 88647b5d987..651277286d4 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt @@ -100,6 +100,7 @@ FILE fqName: fileName:/dataClassMembers.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags: GET_VAR 'tmp1: T' type=T origin=null SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ CALL 'plus(Int): Int' type=kotlin.Int origin=null @@ -127,11 +128,13 @@ FILE fqName: fileName:/dataClassMembers.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test + typeOperand: CLASS CLASS name:Test modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:Test flags:val TYPE_OP type=Test origin=CAST typeOperand=Test + typeOperand: CLASS CLASS name:Test modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt index 452c210b3f0..30f0ea6119e 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt @@ -62,8 +62,7 @@ FILE fqName: fileName:/delegatedMembers.kt $this: GET_FIELD '`Test$IBase$delegate`: IBase' type=IBase origin=null receiver: GET_VAR 'this@Test: Test' type=Test origin=null t: GET_VAR 'value-parameter t: TT' type=TT origin=null - x: TYPE_OP type=X origin=IMPLICIT_CAST typeOperand=X - GET_VAR 'value-parameter x: X' type=X origin=null + x: GET_VAR 'value-parameter x: X' type=X origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:Test, x:kotlin.Int) returnType:Unit flags: overridden: FUN name:foo visibility:public modality:ABSTRACT <> ($this:IBase, x:kotlin.Int) returnType:Unit flags: diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt index 60f616a0775..998c2d07d8b 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt @@ -79,6 +79,7 @@ FILE fqName: fileName:/arrayAugmentedAssignment1.kt VALUE_PARAMETER name:c index:0 type:C flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0_array type:kotlin.IntArray flags:val CALL '(): IntArray' type=kotlin.IntArray origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt index dde11602318..e67019dba1e 100644 --- a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt +++ b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt @@ -3,6 +3,7 @@ FILE fqName: fileName:/booleanConstsInAndAndOrOr.kt VALUE_PARAMETER name:b index:0 type:kotlin.Boolean flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null @@ -15,6 +16,7 @@ FILE fqName: fileName:/booleanConstsInAndAndOrOr.kt VALUE_PARAMETER name:b index:0 type:kotlin.Boolean flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: WHEN type=kotlin.Boolean origin=OROR BRANCH if: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt index 96c63df6156..d0c779c7277 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt @@ -101,6 +101,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=PREFIX_INCR SET_VAR 'i: Int' type=kotlin.Unit origin=PREFIX_INCR CALL 'inc(): Int' type=kotlin.Int origin=PREFIX_INCR @@ -112,6 +113,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt DO_WHILE label=Inner origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=PREFIX_INCR SET_VAR 'j: Int' type=kotlin.Unit origin=PREFIX_INCR CALL 'inc(): Int' type=kotlin.Int origin=PREFIX_INCR diff --git a/compiler/testData/ir/irText/expressions/classReference.txt b/compiler/testData/ir/irText/expressions/classReference.txt index e18211b8954..8ec483dacb4 100644 --- a/compiler/testData/ir/irText/expressions/classReference.txt +++ b/compiler/testData/ir/irText/expressions/classReference.txt @@ -23,14 +23,18 @@ FILE fqName: fileName:/classReference.kt FUN name:test visibility:public modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CLASS_REFERENCE 'A' type=kotlin.reflect.KClass TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: GET_CLASS type=kotlin.reflect.KClass CALL 'constructor A()' type=A origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '() on KClass: Class' type=java.lang.Class origin=GET_PROPERTY $receiver: CLASS_REFERENCE 'A' type=kotlin.reflect.KClass TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '() on KClass: Class' type=java.lang.Class origin=GET_PROPERTY $receiver: GET_CLASS type=kotlin.reflect.KClass CALL 'constructor A()' type=A origin=null diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.txt index 5122f78d89a..37b9ff20a6a 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.txt @@ -7,6 +7,7 @@ FILE fqName: fileName:/coercionToUnit.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): Unit' TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CONST Int type=kotlin.Int value=42 FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:Function0 flags: @@ -17,12 +18,14 @@ FILE fqName: fileName:/coercionToUnit.kt VALUE_PARAMETER name:mc index:0 type:kotlin.collections.MutableCollection flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL 'add(String): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'value-parameter mc: MutableCollection' type=kotlin.collections.MutableCollection origin=null element: CONST String type=kotlin.String value= FUN name:test3 visibility:public modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Unit? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:java.io.PrintStream! flags:val GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY @@ -36,9 +39,11 @@ FILE fqName: fileName:/coercionToUnit.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_VAR 'tmp0_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null x: CONST String type=kotlin.String value=Hello, TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Unit? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:java.io.PrintStream! flags:val GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY @@ -52,6 +57,7 @@ FILE fqName: fileName:/coercionToUnit.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_VAR 'tmp1_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null x: CONST String type=kotlin.String value=world! diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt index f557f2e3e5c..64ef5962b03 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt @@ -119,6 +119,7 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt VAR name:i type:kotlin.Int flags:var CONST Int type=kotlin.Int value=0 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp1_array type:kotlin.IntArray flags:val GET_VAR 'value-parameter a: IntArray' type=kotlin.IntArray origin=null @@ -143,6 +144,7 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt FUN name:test2 visibility:public modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0_this type:X1 flags:val GET_OBJECT 'X1' type=X1 @@ -156,6 +158,7 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt $this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null GET_VAR 'tmp1: Int' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp2_this type:X1.X2 flags:val GET_OBJECT 'X2' type=X1.X2 @@ -169,6 +172,7 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt $this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null GET_VAR 'tmp3: Int' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp4_this type:X1.X2.X3 flags:val GET_OBJECT 'X3' type=X1.X2.X3 diff --git a/compiler/testData/ir/irText/expressions/elvis.txt b/compiler/testData/ir/irText/expressions/elvis.txt index 4c5d7c3cd6e..0117d3092cc 100644 --- a/compiler/testData/ir/irText/expressions/elvis.txt +++ b/compiler/testData/ir/irText/expressions/elvis.txt @@ -52,12 +52,14 @@ FILE fqName: fileName:/elvis.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String' CONST String type=kotlin.String value= WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String? + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String' CONST String type=kotlin.String value= @@ -71,10 +73,12 @@ FILE fqName: fileName:/elvis.kt arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null FUN name:test4 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:Any flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.txt index 99ff47e3bb5..d1313091626 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/comparableWithDoubleOrFloat.txt @@ -9,16 +9,20 @@ FILE fqName: fileName:/comparableWithDoubleOrFloat.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Comparable' type=kotlin.Comparable origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Comparable' type=kotlin.Comparable origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Comparable' type=kotlin.Comparable origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Comparable' type=kotlin.Comparable origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -33,16 +37,20 @@ FILE fqName: fileName:/comparableWithDoubleOrFloat.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Comparable' type=kotlin.Comparable origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Comparable' type=kotlin.Comparable origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'less(Float, Float): Boolean' type=kotlin.Boolean origin=LT arg0: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Comparable' type=kotlin.Comparable origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Comparable' type=kotlin.Comparable origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt index db183d1b915..5b61a6ecd06 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt @@ -8,6 +8,7 @@ FILE fqName: fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt arg1: WHEN type=kotlin.Double origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: BLOCK type=kotlin.Nothing origin=EXCLEXCL VAR IR_TEMPORARY_VARIABLE name:tmp0_notnull type:kotlin.Nothing? flags:val @@ -24,5 +25,6 @@ FILE fqName: fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.txt index 3f33439ac15..92690efd111 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.txt @@ -15,11 +15,13 @@ FILE fqName: fileName:/floatingPointCompareTo.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Double): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter x: Double' type=kotlin.Double origin=null other: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -35,8 +37,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -44,8 +48,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Double): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null other: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -67,11 +73,13 @@ FILE fqName: fileName:/floatingPointCompareTo.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Float): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter x: Float' type=kotlin.Float origin=null other: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -87,8 +95,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -96,8 +106,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Float): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null other: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -113,8 +125,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -122,8 +136,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Double): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null other: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -139,8 +155,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -148,8 +166,10 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Float): Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null other: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -171,11 +191,13 @@ FILE fqName: fileName:/floatingPointCompareTo.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Float): Int' type=kotlin.Int origin=null $this: GET_VAR 'this@test2fr: Float' type=kotlin.Float origin=null other: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH @@ -189,11 +211,13 @@ FILE fqName: fileName:/floatingPointCompareTo.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'compareTo(Double): Int' type=kotlin.Int origin=null $this: GET_VAR 'this@test3fr: Float' type=kotlin.Float origin=null other: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: CONST Int type=kotlin.Int value=0 BRANCH diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.txt index db923f0df2b..35d503f5c47 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEqeq.txt @@ -39,10 +39,12 @@ FILE fqName: fileName:/floatingPointEqeq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Double' type=kotlin.Double origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -57,16 +59,20 @@ FILE fqName: fileName:/floatingPointEqeq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -111,10 +117,12 @@ FILE fqName: fileName:/floatingPointEqeq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Float' type=kotlin.Float origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -129,16 +137,20 @@ FILE fqName: fileName:/floatingPointEqeq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -153,8 +165,10 @@ FILE fqName: fileName:/floatingPointEqeq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -162,8 +176,10 @@ FILE fqName: fileName:/floatingPointEqeq.kt then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -178,17 +194,21 @@ FILE fqName: fileName:/floatingPointEqeq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.txt index 2fe78da26fa..a77cc7ef4f9 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointEquals.txt @@ -39,6 +39,7 @@ FILE fqName: fileName:/floatingPointEquals.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'value-parameter x: Double' type=kotlin.Double origin=null @@ -56,8 +57,10 @@ FILE fqName: fileName:/floatingPointEquals.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -108,6 +111,7 @@ FILE fqName: fileName:/floatingPointEquals.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'value-parameter x: Float' type=kotlin.Float origin=null @@ -125,8 +129,10 @@ FILE fqName: fileName:/floatingPointEquals.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -147,8 +153,10 @@ FILE fqName: fileName:/floatingPointEquals.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -169,8 +177,10 @@ FILE fqName: fileName:/floatingPointEquals.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -221,6 +231,7 @@ FILE fqName: fileName:/floatingPointEquals.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'this@test5fr: Float' type=kotlin.Float origin=null @@ -236,6 +247,7 @@ FILE fqName: fileName:/floatingPointEquals.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'this@test6fr: Float' type=kotlin.Float origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.txt index dbbcf6e354f..de5cced4bd5 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointExcleq.txt @@ -43,11 +43,13 @@ FILE fqName: fileName:/floatingPointExcleq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: GET_VAR 'value-parameter x: Double' type=kotlin.Double origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -62,8 +64,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -71,8 +75,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt then: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -121,11 +127,13 @@ FILE fqName: fileName:/floatingPointExcleq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: GET_VAR 'value-parameter x: Float' type=kotlin.Float origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -140,8 +148,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -149,8 +159,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt then: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -165,8 +177,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -175,8 +189,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt arg0: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -191,8 +207,10 @@ FILE fqName: fileName:/floatingPointExcleq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -200,9 +218,11 @@ FILE fqName: fileName:/floatingPointExcleq.kt then: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.txt index e7fcfe56a5d..2ade485a70b 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointLess.txt @@ -15,10 +15,12 @@ FILE fqName: fileName:/floatingPointLess.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: GET_VAR 'value-parameter x: Double' type=kotlin.Double origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -33,16 +35,20 @@ FILE fqName: fileName:/floatingPointLess.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -63,10 +69,12 @@ FILE fqName: fileName:/floatingPointLess.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'less(Float, Float): Boolean' type=kotlin.Boolean origin=LT arg0: GET_VAR 'value-parameter x: Float' type=kotlin.Float origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -81,16 +89,20 @@ FILE fqName: fileName:/floatingPointLess.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'less(Float, Float): Boolean' type=kotlin.Boolean origin=LT arg0: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -105,8 +117,10 @@ FILE fqName: fileName:/floatingPointLess.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -114,8 +128,10 @@ FILE fqName: fileName:/floatingPointLess.kt then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -130,17 +146,21 @@ FILE fqName: fileName:/floatingPointLess.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt index 4dc068c9d58..ea8ae69221d 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt @@ -7,6 +7,7 @@ FILE fqName: fileName:/nullableAnyAsIntToDouble.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT arg0: BLOCK type=kotlin.Double? origin=SAFE_CALL @@ -22,6 +23,7 @@ FILE fqName: fileName:/nullableAnyAsIntToDouble.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null arg1: GET_VAR 'value-parameter y: Double' type=kotlin.Double origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt index 8c3360b875c..ba840143d38 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt @@ -15,6 +15,7 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float? + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Double?' type=kotlin.Double? origin=null @@ -31,6 +32,7 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -43,6 +45,7 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int? + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Double?' type=kotlin.Double? origin=null @@ -59,6 +62,7 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -73,8 +77,10 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt if: WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int? + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -93,8 +99,10 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null arg1: TYPE_OP type=kotlin.Double? origin=IMPLICIT_CAST typeOperand=kotlin.Double? + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.txt index e4f5b67b693..2233daa3f66 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/typeParameterWithPrimitiveNumericSupertype.txt @@ -10,6 +10,7 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null @@ -28,9 +29,11 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: GET_VAR 'value-parameter y: T' type=T origin=null BRANCH @@ -47,10 +50,12 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: GET_VAR 'value-parameter y: T' type=T origin=null BRANCH @@ -67,10 +72,12 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toFloat(): Float' type=kotlin.Float origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: GET_VAR 'value-parameter y: T' type=T origin=null BRANCH @@ -87,10 +94,12 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toFloat(): Float' type=kotlin.Float origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: GET_VAR 'value-parameter y: T' type=T origin=null BRANCH @@ -110,10 +119,12 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Float?, Float?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toFloat(): Float' type=kotlin.Float origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null arg1: GET_VAR 'value-parameter y: R' type=R origin=null BRANCH @@ -130,6 +141,7 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null @@ -157,11 +169,13 @@ FILE fqName: fileName:/typeParameterWithPrimitiveNumericSupertype.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: GET_VAR 'value-parameter x: T' type=T origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.txt index 4655076b193..b92fad1a13b 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.txt @@ -21,6 +21,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testSmartCastInWhenSubject(Any): Int' CONST Int type=kotlin.Int value=-1 @@ -32,6 +33,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'tmp0_subject: Any' type=kotlin.Any origin=null arg1: CONST Double type=kotlin.Double value=0.0 then: CONST Int type=kotlin.Int value=0 @@ -45,6 +47,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testSmartCastInWhenCondition(Double, Any): Int' CONST Int type=kotlin.Int value=-1 @@ -57,6 +60,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt if: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_subject: Double' type=kotlin.Double origin=null arg1: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CONST Int type=kotlin.Int value=0 BRANCH @@ -72,11 +76,13 @@ FILE fqName: fileName:/whenByFloatingPoint.kt WHEN type=kotlin.Int origin=WHEN BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Double + typeOperand: UNBOUND: class Double : kotlin.Number, kotlin.Comparable, java.io.Serializable GET_VAR 'tmp0_subject: Any' type=kotlin.Any origin=null then: CONST Int type=kotlin.Int value=-1 BRANCH if: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'tmp0_subject: Any' type=kotlin.Any origin=null arg1: CONST Double type=kotlin.Double value=0.0 then: CONST Int type=kotlin.Int value=0 @@ -90,12 +96,14 @@ FILE fqName: fileName:/whenByFloatingPoint.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testSmartCastToDifferentTypes(Any, Any): Int' CONST Int type=kotlin.Int value=-1 WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testSmartCastToDifferentTypes(Any, Any): Int' CONST Int type=kotlin.Int value=-1 @@ -107,9 +115,11 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'tmp0_subject: Any' type=kotlin.Any origin=null arg1: CALL 'toDouble(): Double' type=kotlin.Double origin=null $this: TYPE_OP type=kotlin.Float origin=IMPLICIT_CAST typeOperand=kotlin.Float + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags: GET_VAR 'value-parameter y: Any' type=kotlin.Any origin=null then: CONST Int type=kotlin.Int value=0 BRANCH @@ -135,12 +145,14 @@ FILE fqName: fileName:/whenByFloatingPoint.kt x: WHEN type=kotlin.Double origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testWithPrematureExitInConditionSubexpression(Any): Int' CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CONST Int type=kotlin.Int value=0 BRANCH diff --git a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt index 178b1bd9b47..f0c63d04328 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt @@ -3,6 +3,7 @@ FILE fqName: fileName:/implicitCastOnPlatformType.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test(): String' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: CALL 'getProperty(String!): String!' type=kotlin.String! origin=null key: CONST String type=kotlin.String value=test diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt index 05b29fca7df..c1441f51012 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt @@ -3,6 +3,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY x: CONST String type=kotlin.String value=testFun PROPERTY name:testProp type:kotlin.Any visibility:public modality:FINAL flags:var @@ -10,6 +11,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY x: CONST String type=kotlin.String value=testProp/get RETURN type=kotlin.Nothing from='(): Any' @@ -19,6 +21,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY x: CONST String type=kotlin.String value=testProp/set CLASS CLASS name:TestClass modality:FINAL visibility:public flags: @@ -38,6 +41,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt then: BLOCK type=kotlin.Int origin=null CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY x: CONST String type=kotlin.String value=TestClass/test CONST Int type=kotlin.Int value=42 @@ -51,6 +55,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:PrintStream modality:OPEN visibility:public flags: GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY x: CONST String type=kotlin.String value=TestClass/init FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:Boolean flags: diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.txt index 3f6fd874465..cb14d15afd2 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.txt @@ -50,6 +50,7 @@ FILE fqName: fileName:/lambdaInCAO.kt VALUE_PARAMETER name:a index:0 type:kotlin.Any flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0_array type:kotlin.Any flags:val GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/objectClassReference.txt b/compiler/testData/ir/irText/expressions/objectClassReference.txt index bb9cd523808..084618fb238 100644 --- a/compiler/testData/ir/irText/expressions/objectClassReference.txt +++ b/compiler/testData/ir/irText/expressions/objectClassReference.txt @@ -23,8 +23,10 @@ FILE fqName: fileName:/objectClassReference.kt FUN name:test visibility:public modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CLASS_REFERENCE 'A' type=kotlin.reflect.KClass TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL '() on KClass: Class' type=java.lang.Class origin=GET_PROPERTY $receiver: CLASS_REFERENCE 'A' type=kotlin.reflect.KClass diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt index f98d34c6283..518e13940c9 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt @@ -27,6 +27,7 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Long visibility:public EXPRESSION_BODY TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Long modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=42 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:Long flags: @@ -37,6 +38,7 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.Short visibility:public EXPRESSION_BODY TYPE_OP type=kotlin.Short origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Short + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Short modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=42 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:Short flags: @@ -47,6 +49,7 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.Byte visibility:public EXPRESSION_BODY TYPE_OP type=kotlin.Byte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Byte + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Byte modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=42 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:Byte flags: @@ -65,20 +68,24 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt CONST Long type=kotlin.Long value=-1 VAR name:test5 type:kotlin.Long? flags:val TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Long modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 VAR name:test6 type:kotlin.Short? flags:val TYPE_OP type=kotlin.Short origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Short + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Short modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 VAR name:test7 type:kotlin.Byte? flags:val TYPE_OP type=kotlin.Byte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Byte + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Byte modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 FUN name:testImplicitArguments visibility:public modality:FINAL <> (x:kotlin.Long) returnType:Unit flags: VALUE_PARAMETER name:x index:0 type:kotlin.Long flags: EXPRESSION_BODY TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Long modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 BLOCK_BODY @@ -90,6 +97,7 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt VALUE_PARAMETER name:x index:0 type:kotlin.Long flags: EXPRESSION_BODY TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Long modality:FINAL visibility:public flags: CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.txt b/compiler/testData/ir/irText/expressions/safeAssignment.txt index f1d688a229d..65f8619a8c7 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.txt @@ -50,6 +50,7 @@ FILE fqName: fileName:/safeAssignment.kt arg0: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt index efed39ed098..2bd181adb9f 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt @@ -70,10 +70,12 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp1_receiver type:test.C? flags:val GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null @@ -90,6 +92,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt VALUE_PARAMETER name:nc index:0 type:test.C? flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp1_array type:kotlin.Int? flags:val BLOCK type=kotlin.Int? origin=SAFE_CALL diff --git a/compiler/testData/ir/irText/expressions/safeCalls.txt b/compiler/testData/ir/irText/expressions/safeCalls.txt index 87a896465f4..7e3f49c9904 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.txt @@ -127,6 +127,7 @@ FILE fqName: fileName:/safeCalls.kt arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -160,6 +161,7 @@ FILE fqName: fileName:/safeCalls.kt FUN name:box visibility:public modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Int flags:val CONST Int type=kotlin.Int value=42 diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt index afb16f4cc83..337986c21bd 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt @@ -14,11 +14,13 @@ FILE fqName: fileName:/Derived.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null then: BLOCK type=kotlin.Unit origin=null SET_FIELD 'value: String!' type=kotlin.Unit origin=EQ receiver: GET_VAR 'this@Derived: Derived' type=Derived origin=null value: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null PROPERTY FAKE_OVERRIDE name:value type:kotlin.String! visibility:public modality:FINAL flags:var FIELD FAKE_OVERRIDE name:value type:kotlin.String! visibility:public diff --git a/compiler/testData/ir/irText/expressions/smartCasts.txt b/compiler/testData/ir/irText/expressions/smartCasts.txt index 99c0e7d0a60..0bb048f313f 100644 --- a/compiler/testData/ir/irText/expressions/smartCasts.txt +++ b/compiler/testData/ir/irText/expressions/smartCasts.txt @@ -21,23 +21,28 @@ FILE fqName: fileName:/smartCasts.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='test1(Any): Unit' GET_OBJECT 'Unit' type=kotlin.Unit CALL 'println(Int): Unit' type=kotlin.Unit origin=null message: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null CALL 'expectsString(String): Unit' type=kotlin.Unit origin=null s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null CALL 'expectsInt(Int): Unit' type=kotlin.Unit origin=null i: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null CALL 'expectsString(String): Unit' type=kotlin.Unit origin=null s: CALL 'overloaded(String): String' type=kotlin.String origin=null s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:String flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: @@ -45,12 +50,14 @@ FILE fqName: fileName:/smartCasts.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='test2(Any): String' CONST String type=kotlin.String value= RETURN type=kotlin.Nothing from='test2(Any): String' CALL 'overloaded(String): String' type=kotlin.String origin=null s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:String flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: @@ -58,10 +65,12 @@ FILE fqName: fileName:/smartCasts.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='test3(Any): String' CONST String type=kotlin.String value= RETURN type=kotlin.Nothing from='test3(Any): String' TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt index 7059c27cd93..8a391dd9dc8 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt @@ -49,6 +49,7 @@ FILE fqName: fileName:/smartCastsWithDestructuring.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=I2 + typeOperand: CLASS INTERFACE name:I2 modality:ABSTRACT visibility:public flags: GET_VAR 'value-parameter x: I1' type=I1 origin=null then: RETURN type=kotlin.Nothing from='test(I1): Unit' GET_OBJECT 'Unit' type=kotlin.Unit @@ -61,5 +62,6 @@ FILE fqName: fileName:/smartCastsWithDestructuring.kt VAR name:c2 type:kotlin.String flags:val CALL 'component2() on I2: String' type=kotlin.String origin=COMPONENT_N(index=2) $receiver: TYPE_OP type=I2 origin=IMPLICIT_CAST typeOperand=I2 + typeOperand: CLASS INTERFACE name:I2 modality:ABSTRACT visibility:public flags: GET_VAR 'tmp0_container: I1' type=I1 origin=null diff --git a/compiler/testData/ir/irText/expressions/throw.txt b/compiler/testData/ir/irText/expressions/throw.txt index 169b8dc6470..7c0882a4603 100644 --- a/compiler/testData/ir/irText/expressions/throw.txt +++ b/compiler/testData/ir/irText/expressions/throw.txt @@ -9,9 +9,11 @@ FILE fqName: fileName:/throw.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Throwable + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Throwable modality:OPEN visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null then: BLOCK type=kotlin.Nothing origin=null THROW type=kotlin.Nothing TYPE_OP type=kotlin.Throwable origin=IMPLICIT_CAST typeOperand=kotlin.Throwable + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Throwable modality:OPEN visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/tryCatch.txt b/compiler/testData/ir/irText/expressions/tryCatch.txt index 16d52329c58..821c07d2f76 100644 --- a/compiler/testData/ir/irText/expressions/tryCatch.txt +++ b/compiler/testData/ir/irText/expressions/tryCatch.txt @@ -23,6 +23,7 @@ FILE fqName: fileName:/tryCatch.kt CALL 'println(): Unit' type=kotlin.Unit origin=null CONST Int type=kotlin.Int value=24 finally: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=null CALL 'println(): Unit' type=kotlin.Unit origin=null CONST Int type=kotlin.Int value=555 diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt index fc1db299a77..656b7700d11 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt @@ -5,6 +5,7 @@ FILE fqName: fileName:/tryCatchWithImplicitCast.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testImplicitCast(Any): Unit' GET_OBJECT 'Unit' type=kotlin.Unit @@ -12,6 +13,7 @@ FILE fqName: fileName:/tryCatchWithImplicitCast.kt TRY type=kotlin.String try: BLOCK type=kotlin.String origin=null TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null CATCH parameter=e: Throwable VAR CATCH_PARAMETER name:e type:kotlin.Throwable flags:val diff --git a/compiler/testData/ir/irText/expressions/typeArguments.txt b/compiler/testData/ir/irText/expressions/typeArguments.txt index edc4675666c..e020663e144 100644 --- a/compiler/testData/ir/irText/expressions/typeArguments.txt +++ b/compiler/testData/ir/irText/expressions/typeArguments.txt @@ -6,10 +6,12 @@ FILE fqName: fileName:/typeArguments.kt WHEN type=kotlin.Boolean origin=ANDAND BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Array<*> + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Array modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null then: CALL 'isArrayOf() on Array<*>: Boolean' type=kotlin.Boolean origin=null : String $receiver: TYPE_OP type=kotlin.Array<*> origin=IMPLICIT_CAST typeOperand=kotlin.Array<*> + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Array modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/typeOperators.txt b/compiler/testData/ir/irText/expressions/typeOperators.txt index bd1fb3bc4ec..b2d7e2c3651 100644 --- a/compiler/testData/ir/irText/expressions/typeOperators.txt +++ b/compiler/testData/ir/irText/expressions/typeOperators.txt @@ -21,23 +21,27 @@ FILE fqName: fileName:/typeOperators.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any): Boolean' TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=IThing + typeOperand: CLASS INTERFACE name:IThing modality:ABSTRACT visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:Boolean flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Any): Boolean' TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=IThing + typeOperand: CLASS INTERFACE name:IThing modality:ABSTRACT visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:IThing flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Any): IThing' TYPE_OP type=IThing origin=CAST typeOperand=IThing + typeOperand: CLASS INTERFACE name:IThing modality:ABSTRACT visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN name:test4 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:IThing? flags: VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test4(Any): IThing?' TYPE_OP type=IThing? origin=SAFE_CAST typeOperand=IThing + typeOperand: CLASS INTERFACE name:IThing modality:ABSTRACT visibility:public flags: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt index 74e3838995f..480049ecd86 100644 --- a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt @@ -5,6 +5,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testScalar(Any): IntArray' CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null @@ -12,6 +13,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null elements: VARARG type=IntArray varargElementType=Int TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null FUN name:testSpread visibility:public modality:FINAL <> (a:kotlin.Any) returnType:IntArray flags: VALUE_PARAMETER name:a index:0 type:kotlin.Any flags: @@ -19,6 +21,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:IntArray modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='testSpread(Any): IntArray' CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null @@ -27,5 +30,6 @@ FILE fqName: fileName:/varargWithImplicitCast.kt elements: VARARG type=IntArray varargElementType=Int SPREAD_ELEMENT TYPE_OP type=kotlin.IntArray origin=IMPLICIT_CAST typeOperand=kotlin.IntArray + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:IntArray modality:FINAL visibility:public flags: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/when.txt b/compiler/testData/ir/irText/expressions/when.txt index 9baca599e2a..66af1d235e3 100644 --- a/compiler/testData/ir/irText/expressions/when.txt +++ b/compiler/testData/ir/irText/expressions/when.txt @@ -40,6 +40,7 @@ FILE fqName: fileName:/when.kt then: CONST String type=kotlin.String value=A BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String + typeOperand: UNBOUND: class String : kotlin.Comparable, kotlin.CharSequence, java.io.Serializable GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value=String BRANCH @@ -69,6 +70,7 @@ FILE fqName: fileName:/when.kt then: CONST String type=kotlin.String value=A BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value=String BRANCH diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt index 366e31a0048..7f8e6f0ba5c 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt @@ -11,5 +11,6 @@ FILE fqName: fileName:/whenCoercedToUnit.kt arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CONST Int type=kotlin.Int value=0 diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.txt index b1bd5250bba..107e3d27140 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.txt @@ -12,6 +12,7 @@ FILE fqName: fileName:/whileDoWhile.kt arg0: GET_VAR 'x: Int' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=5 body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0 type:kotlin.Int flags:val GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR @@ -25,6 +26,7 @@ FILE fqName: fileName:/whileDoWhile.kt arg1: CONST Int type=kotlin.Int value=10 body: BLOCK type=kotlin.Unit origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp1 type:kotlin.Int flags:val GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR @@ -40,6 +42,7 @@ FILE fqName: fileName:/whileDoWhile.kt BLOCK type=kotlin.Unit origin=null DO_WHILE label=null origin=DO_WHILE_LOOP body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp2 type:kotlin.Int flags:val GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR @@ -54,6 +57,7 @@ FILE fqName: fileName:/whileDoWhile.kt DO_WHILE label=null origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp3 type:kotlin.Int flags:val GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR @@ -71,15 +75,18 @@ FILE fqName: fileName:/whileDoWhile.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Boolean + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Boolean modality:FINAL visibility:public flags: GET_VAR 'a: Any?' type=kotlin.Any? origin=null then: BLOCK type=kotlin.Unit origin=null WHILE label=null origin=WHILE_LOOP condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Boolean modality:FINAL visibility:public flags: GET_VAR 'a: Any?' type=kotlin.Any? origin=null body: BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null DO_WHILE label=null origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Boolean modality:FINAL visibility:public flags: GET_VAR 'a: Any?' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt index 1ea80cb3e7e..dde562a9af9 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt @@ -109,11 +109,13 @@ FILE fqName: fileName:/destructuringInLambda.kt WHEN type=kotlin.Unit origin=null BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=A + typeOperand: CLASS CLASS name:A modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' CONST Boolean type=kotlin.Boolean value=false VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:A flags:val TYPE_OP type=A origin=CAST typeOperand=A + typeOperand: CLASS CLASS name:A modality:FINAL visibility:public flags:data GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/lambdas/localFunction.txt b/compiler/testData/ir/irText/lambdas/localFunction.txt index 8a2a507e748..349bdfd578f 100644 --- a/compiler/testData/ir/irText/lambdas/localFunction.txt +++ b/compiler/testData/ir/irText/lambdas/localFunction.txt @@ -6,6 +6,7 @@ FILE fqName: fileName:/localFunction.kt FUN name:local visibility:local modality:FINAL <> () returnType:Unit flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0 type:kotlin.Int flags:val GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index 236f5ae6df2..031783f20b1 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -93,6 +93,7 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt VALUE_PARAMETER name:invokeImpl index:1 type:IInvoke flags: BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null : A : Int diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.txt index 8a12610d40e..befa71d5467 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.txt @@ -27,6 +27,7 @@ FILE fqName: fileName:/coercionInLoop.kt CONST String type=kotlin.String value=Fail GET_VAR 'i: Int' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp0 type:kotlin.Int flags:val GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR @@ -36,4 +37,3 @@ FILE fqName: fileName:/coercionInLoop.kt GET_VAR 'tmp0: Int' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='box(): String' CONST String type=kotlin.String value=OK - diff --git a/compiler/testData/ir/irText/stubs/builtinMap.txt b/compiler/testData/ir/irText/stubs/builtinMap.txt index beb04f92360..40c01d3b484 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.txt @@ -32,6 +32,7 @@ FILE fqName: fileName:/builtinMap.kt BLOCK_BODY RETURN type=kotlin.Nothing from='() on LinkedHashMap /* = LinkedHashMap */: Unit' TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: CALL 'put(K!, V!): V?' type=V? origin=null $this: GET_VAR 'this@: LinkedHashMap<(K..K?), (V..V?)>' type=kotlin.collections.LinkedHashMap /* = java.util.LinkedHashMap */ origin=null key: CALL '(): K' type=K origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/stubs/builtinMap__builtinsmodule.txt b/compiler/testData/ir/irText/stubs/builtinMap__builtinsmodule.txt index 2d7bca594dc..1955faee595 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap__builtinsmodule.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap__builtinsmodule.txt @@ -6,6 +6,20 @@ MODULE_FRAGMENT name: FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> () returnType:String flags: FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> (other:kotlin.Any?) returnType:Boolean flags: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Any? flags: + CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: + superClasses: + CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags: + CONSTRUCTOR IR_EXTERNAL_DECLARATION_STUB visibility:private <> () returnType:kotlin.Unit flags: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> (other:kotlin.Any?) returnType:Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> (other:kotlin.Any?) returnType:Boolean flags: + VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Any? flags: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> () returnType:Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> () returnType:Int flags: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> () returnType:String flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> () returnType:String flags: EXTERNAL_PACKAGE_FRAGMENT fqName:kotlin.collections CLASS IR_EXTERNAL_DECLARATION_STUB INTERFACE name:MutableMap modality:ABSTRACT visibility:public flags: superClasses: diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index 3a852156ae8..5e545077386 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -21,10 +21,7 @@ import junit.framework.TestCase import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference -import org.jetbrains.kotlin.ir.expressions.IrFunctionReference -import org.jetbrains.kotlin.ir.expressions.IrLocalDelegatedPropertyReference -import org.jetbrains.kotlin.ir.expressions.IrPropertyReference +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid @@ -242,6 +239,10 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { } } } + + override fun visitTypeOperator(expression: IrTypeOperatorCall) { + expression.typeOperandClassifier.checkBinding("type operand", expression) + } } internal class Expectations(val regexps: List, val irTreeFileLabels: List)