diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 975447d93c5..2db4d3ce71c 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1656,6 +1656,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.kt"); } + @TestMetadata("platformTypeReceiver.kt") + public void testPlatformTypeReceiver() throws Exception { + runTest("compiler/testData/ir/irText/types/platformTypeReceiver.kt"); + } + @TestMetadata("smartCastOnFieldReceiverOfGenericType.kt") public void testSmartCastOnFieldReceiverOfGenericType() throws Exception { runTest("compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt"); diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt index ae07eb569b7..746d9da2218 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt @@ -124,6 +124,7 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass { } private fun lowerImplicitDynamicCast(expression: IrTypeOperatorCall) = expression.run { + // TODO check argument assert(operator == IrTypeOperator.IMPLICIT_DYNAMIC_CAST) argument } 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 937584d39ff..eb7114458cd 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 @@ -65,11 +65,18 @@ class Psi2IrTranslator( ): GeneratorContext = GeneratorContext(configuration, moduleDescriptor, bindingContext, languageVersionSettings, symbolTable, extensions) - fun generateModuleFragment(context: GeneratorContext, ktFiles: Collection, deserializer: IrDeserializer? = null): IrModuleFragment { + fun generateModuleFragment( + context: GeneratorContext, + ktFiles: Collection, + deserializer: IrDeserializer? = null + ): IrModuleFragment { val moduleGenerator = ModuleGenerator(context) val irModule = moduleGenerator.generateModuleFragmentWithoutDependencies(ktFiles) + + // This is required for implicit casts insertion on IrTypes (work-in-progress). moduleGenerator.generateUnboundSymbolsAsDependencies(irModule, deserializer) irModule.patchDeclarationParents() + postprocess(context, irModule) moduleGenerator.generateUnboundSymbolsAsDependencies(irModule, deserializer) return irModule 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 ba94ebfc057..24d45749dc4 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 @@ -16,168 +16,67 @@ package org.jetbrains.kotlin.psi2ir.transformations +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrField +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol -import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol -import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.types.impl.makeTypeIntersection -import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection +import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.util.TypeTranslator import org.jetbrains.kotlin.ir.util.coerceToUnitIfNeeded -import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.psi2ir.containsNull import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext -import org.jetbrains.kotlin.types.isNullabilityFlexible +import org.jetbrains.kotlin.psi2ir.generators.GeneratorExtensions +import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.types.checker.KotlinTypeChecker +import org.jetbrains.kotlin.types.typeUtil.isNullableAny import org.jetbrains.kotlin.types.typeUtil.isUnit +import org.jetbrains.kotlin.types.typeUtil.makeNotNullable +import org.jetbrains.kotlin.types.typeUtil.makeNullable fun insertImplicitCasts(element: IrElement, context: GeneratorContext) { element.transformChildren( - InsertImplicitCasts(context.irBuiltIns, context.typeTranslator), + InsertImplicitCasts(context.builtIns, context.irBuiltIns, context.typeTranslator, context.extensions.samConversion), null ) } open class InsertImplicitCasts( + private val builtIns: KotlinBuiltIns, private val irBuiltIns: IrBuiltIns, - private val typeTranslator: TypeTranslator + private val typeTranslator: TypeTranslator, + private val samConversion: GeneratorExtensions.SamConversion ) : IrElementTransformerVoid() { - private fun getDeclarationTypeParameters(declaration: IrFunction): List { - return (declaration.typeParameters + if (declaration is IrConstructor) declaration.parentAsClass.typeParameters else emptyList()) - .map { it.symbol } - } + private fun KotlinType.toIrType() = typeTranslator.translateType(this) - private fun getDispatchReceiverTypeParameters(declaration: IrDeclaration): List { - val classWithTypeParameters = - if (declaration.isNonStaticMemberDeclaration()) - declaration.parentAsClass - else - return emptyList() - - return extractTypeParameters(classWithTypeParameters).map { it.symbol } - } - - private fun IrDeclaration.isNonStaticMemberDeclaration() = - this is IrFunction && dispatchReceiverParameter != null || - this is IrField && !isStatic - - private fun getTypeArguments( - expression: IrExpression, - declarationTypeParameters: List - ): List = - when (expression) { - is IrMemberAccessExpression -> { - val expressionTypeArguments = declarationTypeParameters.map { p -> - makeTypeProjection(expression.getTypeArgument(p.owner.index)!!, p.owner.variance) - } - val receiverTypeArguments = expression.dispatchReceiver.getTypeArgumentsForReceiver() - expressionTypeArguments + receiverTypeArguments - } - is IrFieldAccessExpression -> { - expression.receiver.getTypeArgumentsForReceiver() - } - else -> { - throw AssertionError("Unexpected expression: ${expression.render()}") - } - } - - private fun IrExpression?.getTypeArgumentsForReceiver(): List { - if (this == null) return emptyList() - val expressionType = type as? IrSimpleType ?: return emptyList() - return expressionType.arguments - } - - private fun IrType.substitute(typeParameters: List, typeArguments: List): IrType = - IrTypeSubstitutor(typeParameters.distinct(), typeArguments, irBuiltIns).substitute(this) - - override fun visitFunctionReference(expression: IrFunctionReference): IrExpression = + override fun visitCallableReference(expression: IrCallableReference): IrExpression = expression.transformPostfix { - val declaration = symbol.owner - val declarationTypeParameters = getDeclarationTypeParameters(declaration) - val dispatchReceiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeParameters = declarationTypeParameters + dispatchReceiverTypeParameters - val typeArguments = getTypeArguments(expression, declarationTypeParameters) - dispatchReceiver = dispatchReceiver?.cast( - declaration.dispatchReceiverParameter?.type?.substitute(typeParameters, typeArguments) - ) - extensionReceiver = extensionReceiver?.cast( - declaration.extensionReceiverParameter?.type?.substitute(typeParameters, typeArguments) - ) - } - - override fun visitPropertyReference(expression: IrPropertyReference): IrExpression = - expression.transformPostfix { - val dispatchReceiver = expression.run { - getter?.owner?.dispatchReceiverParameter - ?: setter?.owner?.dispatchReceiverParameter - } - val extensionReceiver = expression.run { - getter?.owner?.extensionReceiverParameter - ?: setter?.owner?.extensionReceiverParameter - } - this.dispatchReceiver = this.dispatchReceiver?.cast(dispatchReceiver?.type) - this.extensionReceiver = this.extensionReceiver?.cast(extensionReceiver?.type) - } - - override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference): IrExpression = - expression.transformPostfix { - val declaration = expression.getter.owner - val declarationTypeParameters = getDeclarationTypeParameters(declaration) - val receiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeParameters = declarationTypeParameters + receiverTypeParameters - val typeArguments = getTypeArguments(expression, declarationTypeParameters) - dispatchReceiver = dispatchReceiver?.cast( - declaration.dispatchReceiverParameter?.run { - type.substitute(typeParameters, typeArguments) - } - ) - extensionReceiver = extensionReceiver?.cast( - declaration.extensionReceiverParameter?.run { - type.substitute(typeParameters, typeArguments) - } - ) + transformReceiverArguments() } private fun IrMemberAccessExpression.transformReceiverArguments() { - val declaration = (this as IrFunctionAccessExpression).symbol.owner - val declarationTypeParameters = getDeclarationTypeParameters(declaration) - val receiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeParameters = declarationTypeParameters + receiverTypeParameters - val typeArguments = getTypeArguments(this, declarationTypeParameters) - - dispatchReceiver = dispatchReceiver?.cast( - declaration.dispatchReceiverParameter?.run { - type.substitute(typeParameters, typeArguments) - } - ) - extensionReceiver = extensionReceiver?.cast( - declaration.extensionReceiverParameter?.run { - type.substitute(typeParameters, typeArguments) - } - ) + dispatchReceiver = dispatchReceiver?.cast(descriptor.dispatchReceiverParameter?.type) + extensionReceiver = extensionReceiver?.cast(descriptor.extensionReceiverParameter?.type) } override fun visitMemberAccess(expression: IrMemberAccessExpression): IrExpression = - with(expression as IrFunctionAccessExpression) { - val declaration = symbol.owner - val declarationTypeParameters = getDeclarationTypeParameters(declaration) - val receiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeArguments = getTypeArguments(expression, declarationTypeParameters) - val typeParameters = declarationTypeParameters + receiverTypeParameters - transformPostfix { - transformReceiverArguments() - for (index in declaration.valueParameters.indices) { - val argument = getValueArgument(index) ?: continue - val parameterType = declaration.valueParameters[index].type.substitute(typeParameters, typeArguments) - putValueArgument(index, argument.cast(parameterType)) - } + expression.transformPostfix { + transformReceiverArguments() + for (index in descriptor.valueParameters.indices) { + val argument = getValueArgument(index) ?: continue + val parameterType = descriptor.valueParameters[index].type + putValueArgument(index, argument.cast(parameterType)) } } @@ -211,55 +110,35 @@ open class InsertImplicitCasts( value = if (expression.returnTargetSymbol is IrConstructorSymbol) { value.coerceToUnit() } else { - value.cast(with(expression.returnTargetSymbol.owner as IrFunction) { returnType }) + value.cast(expression.returnTarget.returnType) } } override fun visitSetVariable(expression: IrSetVariable): IrExpression = expression.transformPostfix { - value = value.cast(expression.symbol.owner.type) - } - - override fun visitGetField(expression: IrGetField): IrExpression = - expression.transformPostfix { - val declaration = expression.symbol.owner - val receiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeArguments = getTypeArguments(expression, receiverTypeParameters) - receiver = receiver?.cast( - declaration.parentAsClass.thisReceiver?.run { - type.substitute(receiverTypeParameters, typeArguments) - } - ) + value = value.cast(expression.descriptor.type) } override fun visitSetField(expression: IrSetField): IrExpression = expression.transformPostfix { - val declaration = expression.symbol.owner - val receiverTypeParameters = getDispatchReceiverTypeParameters(declaration) - val typeArguments = getTypeArguments(expression, receiverTypeParameters) - receiver = receiver?.cast( - declaration.parentAsClass.thisReceiver?.run { - type.substitute(receiverTypeParameters, typeArguments) - } - ) - value = value.cast(expression.symbol.owner.type.substitute(receiverTypeParameters, typeArguments)) + value = value.cast(expression.descriptor.type) } override fun visitVariable(declaration: IrVariable): IrVariable = declaration.transformPostfix { - initializer = initializer?.cast(declaration.symbol.owner.type) + initializer = initializer?.cast(declaration.descriptor.type) } override fun visitField(declaration: IrField): IrStatement = declaration.transformPostfix { - initializer?.coerceInnerExpression(symbol.owner.type) + initializer?.coerceInnerExpression(descriptor.type) } override fun visitFunction(declaration: IrFunction): IrStatement = typeTranslator.buildWithScope(declaration) { declaration.transformPostfix { valueParameters.forEach { - it.defaultValue?.coerceInnerExpression(it.type) + it.defaultValue?.coerceInnerExpression(it.descriptor.type) } } } @@ -272,20 +151,20 @@ open class InsertImplicitCasts( override fun visitWhen(expression: IrWhen): IrExpression = expression.transformPostfix { for (irBranch in branches) { - irBranch.condition = irBranch.condition.cast(irBuiltIns.booleanType) + irBranch.condition = irBranch.condition.cast(builtIns.booleanType) irBranch.result = irBranch.result.cast(type) } } override fun visitLoop(loop: IrLoop): IrExpression = loop.transformPostfix { - condition = condition.cast(irBuiltIns.booleanType) + condition = condition.cast(builtIns.booleanType) body = body?.coerceToUnit() } override fun visitThrow(expression: IrThrow): IrExpression = expression.transformPostfix { - value = value.cast(irBuiltIns.throwableType) + value = value.cast(builtIns.throwable.defaultType) } override fun visitTry(aTry: IrTry): IrExpression = @@ -299,15 +178,28 @@ open class InsertImplicitCasts( finallyExpression = finallyExpression?.coerceToUnit() } - override fun visitTypeOperator(expression: IrTypeOperatorCall): IrExpression { - expression.transformChildren() - return when (expression.operator) { - IrTypeOperator.IMPLICIT_CAST -> + override fun visitTypeOperator(expression: IrTypeOperatorCall): IrExpression = + when (expression.operator) { + IrTypeOperator.SAM_CONVERSION -> expression.transformPostfix { + val targetClassDescriptor = typeOperandClassifier.descriptor as? ClassDescriptor + ?: throw AssertionError("Target type of $operator should be a class: ${render()}") + argument = argument.cast(samConversion.getFunctionTypeForSAMClass(targetClassDescriptor)) + } + + IrTypeOperator.IMPLICIT_CAST -> { + // This branch is required for handling specific ambiguous cases in implicit cast insertion, + // such as SAM conversion VS smart cast. + // Here IMPLICIT_CAST serves as a type hint. + // Replace IrTypeOperatorCall(IMPLICIT_CAST, ...) with an argument cast to the required type + // (possibly generating another IrTypeOperatorCall(IMPLICIT_CAST, ...), if required). + + expression.transformChildrenVoid() expression.argument.cast(expression.typeOperand) + } + else -> super.visitTypeOperator(expression) } - } override fun visitVararg(expression: IrVararg): IrExpression = expression.transformPostfix { @@ -321,49 +213,44 @@ open class InsertImplicitCasts( } } - private fun IrExpressionBody.coerceInnerExpression(expectedType: IrType) { + private fun IrExpressionBody.coerceInnerExpression(expectedType: KotlinType) { expression = expression.cast(expectedType) } - private fun IrExpression.cast(expectedType: IrType?): IrExpression { + private fun IrExpression.cast(irType: IrType): IrExpression = + cast(irType.originalKotlinType) + + private fun IrExpression.cast(expectedType: KotlinType?): IrExpression { if (expectedType == null) return this - if (expectedType is IrErrorType) return this + if (expectedType.isError) return this - val notNullableExpectedType = expectedType.makeNotNull() + // TODO here we can have non-denotable KotlinTypes (both in 'this@cast.type' and 'expectedType'). - val valueType = this.type - val valueKotlinType = valueType.originalKotlinType!! + val notNullableExpectedType = expectedType.makeNotNullable() + + val valueType = this.type.originalKotlinType!! return when { - expectedType.isUnit() -> { - expectedType.originalKotlinType?.let { require(it.isUnit()) } + expectedType.isUnit() -> coerceToUnit() - } - valueType is IrDynamicType && expectedType !is IrDynamicType -> { - if (expectedType.isNullableAny()) { + valueType.isDynamic() && !expectedType.isDynamic() -> + if (expectedType.isNullableAny()) this - } else { + else implicitCast(expectedType, IrTypeOperator.IMPLICIT_DYNAMIC_CAST) - } - } - valueKotlinType.isNullabilityFlexible() && valueType.containsNull() && !expectedType.containsNull() -> { + valueType.isNullabilityFlexible() && valueType.containsNull() && !expectedType.containsNull() -> implicitNonNull(valueType, expectedType) - } - valueType.isSubtypeOf(expectedType.makeNullable(), irBuiltIns) -> { + KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, expectedType.makeNullable()) -> this - } - valueType.isInt() && notNullableExpectedType.isBuiltInIntegerType() -> { + KotlinBuiltIns.isInt(valueType) && notNullableExpectedType.isBuiltInIntegerType() -> implicitCast(notNullableExpectedType, IrTypeOperator.IMPLICIT_INTEGER_COERCION) - } - valueType.isSubtypeOf(expectedType, irBuiltIns) -> { - require(valueType.isSubtypeOf(expectedType, irBuiltIns)) + KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, expectedType) -> this - } else -> { val targetType = if (!valueType.containsNull()) notNullableExpectedType else expectedType @@ -372,38 +259,42 @@ open class InsertImplicitCasts( } } - private fun IrExpression.implicitNonNull(valueType: IrType, expectedType: IrType): IrExpression { - val notNullValueType = valueType.getRepresentableUpperBound().makeNotNull() - return implicitCast(notNullValueType, IrTypeOperator.IMPLICIT_NOTNULL).cast(expectedType) + private fun IrExpression.implicitNonNull(valueType: KotlinType, expectedType: KotlinType): IrExpression { + val nonNullValueType = valueType.upperIfFlexible().makeNotNullable() + return implicitCast(nonNullValueType, IrTypeOperator.IMPLICIT_NOTNULL).cast(expectedType) } private fun IrExpression.implicitCast( - targetType: IrType, + targetType: KotlinType, typeOperator: IrTypeOperator ): IrExpression { + val irType = targetType.toIrType() return IrTypeOperatorCallImpl( startOffset, endOffset, - targetType, + irType, typeOperator, - targetType, + irType, this ) } protected open fun IrExpression.coerceToUnit(): IrExpression { - return coerceToUnitIfNeeded(type, irBuiltIns) + val valueType = getKotlinType(this) + return coerceToUnitIfNeeded(valueType, irBuiltIns) } - private fun IrType.isBuiltInIntegerType(): Boolean = - isByte() || isShort() || isInt() || isLong() || - isUByte() || isUShort() || isUInt() || isULong() + protected fun getKotlinType(irExpression: IrExpression) = + irExpression.type.originalKotlinType!! - private fun IrType.getRepresentableUpperBound(): IrType { - if (this !is IrSimpleType) return this - val classifier = this.classifier as? IrTypeParameterSymbol ?: return this - val superTypes = classifier.owner.superTypes - return makeTypeIntersection(superTypes) - } + private fun KotlinType.isBuiltInIntegerType(): Boolean = + KotlinBuiltIns.isByte(this) || + KotlinBuiltIns.isShort(this) || + KotlinBuiltIns.isInt(this) || + KotlinBuiltIns.isLong(this) || + KotlinBuiltIns.isUByte(this) || + KotlinBuiltIns.isUShort(this) || + KotlinBuiltIns.isUInt(this) || + KotlinBuiltIns.isULong(this) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDeclarationBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDeclarationBase.kt index 17a0c60056c..bf9cae252ae 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDeclarationBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrDeclarationBase.kt @@ -34,7 +34,7 @@ abstract class IrDeclarationBase( private var _parent: IrDeclarationParent? = null override var parent: IrDeclarationParent get() = _parent - ?: throw IllegalStateException("Parent not initialized: $this") + ?: throw UninitializedPropertyAccessException("Parent not initialized: $this") set(v) { _parent = v } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeCheckerContext.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeCheckerContext.kt index 476ec34d99b..9f9e68ba68f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeCheckerContext.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeCheckerContext.kt @@ -87,4 +87,9 @@ class IrTypeCheckerContext(override val irBuiltIns: IrBuiltIns) : IrTypeSystemCo is IrSimpleType -> arguments[index] else -> error("Type $this has no arguments") } + + override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean { + require(this is IrType) + return false + } } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt index 69170b29932..f85cefdb069 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt @@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer -import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeProjection @@ -58,9 +57,9 @@ class TypeTranslator( ?: symbolTable.referenceTypeParameter(typeParameterDescriptor) fun translateType(kotlinType: KotlinType): IrType = - translateType(kotlinType, kotlinType, Variance.INVARIANT).type + translateType(kotlinType, Variance.INVARIANT).type - private fun translateType(originalKotlinType: KotlinType, kotlinType: KotlinType, variance: Variance): IrTypeProjection { + private fun translateType(kotlinType: KotlinType, variance: Variance): IrTypeProjection { val approximatedType = LegacyTypeApproximation().approximate(kotlinType) when { @@ -69,7 +68,7 @@ class TypeTranslator( approximatedType.isDynamic() -> return IrDynamicTypeImpl(approximatedType, translateTypeAnnotations(approximatedType.annotations), variance) approximatedType.isFlexible() -> - return translateType(originalKotlinType, approximatedType.upperIfFlexible(), variance) + return translateType(approximatedType.upperIfFlexible(), variance) } val ktTypeConstructor = approximatedType.constructor @@ -77,7 +76,7 @@ class TypeTranslator( ?: throw AssertionError("No descriptor for type $approximatedType") return IrSimpleTypeBuilder().apply { - this.kotlinType = originalKotlinType + this.kotlinType = kotlinType hasQuestionMark = approximatedType.isMarkedNullable this.variance = variance when (ktTypeDescriptor) { @@ -140,6 +139,6 @@ class TypeTranslator( if (it.isStarProjection) IrStarProjectionImpl else - translateType(it.type, it.type, it.projectionKind) + translateType(it.type, it.projectionKind) } } diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.txt index fc69eeb210b..d01d2818e25 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.txt @@ -36,8 +36,7 @@ FILE fqName: fileName:/coercionToUnit.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_VAR 'val tmp0_safe_receiver: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null + $this: GET_VAR 'val tmp0_safe_receiver: java.io.PrintStream? [val] declared in .test3' 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 BLOCK type=kotlin.Unit? origin=SAFE_CALL @@ -52,6 +51,5 @@ FILE fqName: fileName:/coercionToUnit.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_VAR 'val tmp1_safe_receiver: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null + $this: GET_VAR 'val tmp1_safe_receiver: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null x: CONST String type=kotlin.String value="world!" diff --git a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt index e77a3e499d3..c61dd192848 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastOnPlatformType.txt @@ -2,6 +2,5 @@ FILE fqName: fileName:/implicitCastOnPlatformType.kt FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test (): kotlin.String declared in ' - TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun getProperty (key: kotlin.String?): kotlin.String? declared in java.lang.System' type=kotlin.String? origin=null - key: CONST String type=kotlin.String value="test" + CALL 'public open fun getProperty (key: kotlin.String?): kotlin.String? declared in java.lang.System' 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 9d1e7256ca0..2b8d63aeb0b 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt @@ -2,16 +2,14 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt FUN name:testFun visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY x: CONST String type=kotlin.String value="testFun" PROPERTY name:testProp visibility:public modality:FINAL [var] FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Any correspondingProperty: PROPERTY name:testProp visibility:public modality:FINAL [var] BLOCK_BODY CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY x: CONST String type=kotlin.String value="testProp/get" RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in ' CONST Int type=kotlin.Int value=42 @@ -20,8 +18,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt VALUE_PARAMETER name:value index:0 type:kotlin.Any BLOCK_BODY CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY x: CONST String type=kotlin.String value="testProp/set" CLASS CLASS name:TestClass modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestClass @@ -37,8 +34,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt if: CONST Boolean type=kotlin.Boolean value=true then: BLOCK type=kotlin.Int origin=null CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY x: CONST String type=kotlin.String value="TestClass/test" CONST Int type=kotlin.Int value=42 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.TestClass) returnType:kotlin.Int @@ -51,8 +47,7 @@ FILE fqName: fileName:/jvmStaticFieldReference.kt ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY CALL 'public open fun println (x: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' type=java.io.PrintStream? origin=GET_PROPERTY + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:java.io.PrintStream? visibility:public [final,static] ' 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:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.txt index 41e7de1175d..a41154b7541 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConstructors.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.txt @@ -34,8 +34,6 @@ FILE fqName: fileName:/samConstructors.kt BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (a: kotlin.Int?, b: kotlin.Int?): kotlin.Int declared in .test4' CALL 'public final fun minus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MINUS - $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_NOTNULL typeOperand=kotlin.Int - GET_VAR 'a: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null - other: TYPE_OP type=kotlin.Int origin=IMPLICIT_NOTNULL typeOperand=kotlin.Int - GET_VAR 'b: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null + $this: GET_VAR 'a: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null + other: GET_VAR 'b: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null FUNCTION_REFERENCE 'local final fun (a: kotlin.Int?, b: kotlin.Int?): kotlin.Int declared in .test4' type=kotlin.Function2 origin=LAMBDA diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.txt index bb3cc620284..6aa740e5193 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.txt @@ -106,10 +106,9 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt CALL 'public open fun run1 (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null $this: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .J' type=.J origin=null r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? - TYPE_OP type=kotlin.Function0 origin=IMPLICIT_NOTNULL typeOperand=kotlin.Function0 - CALL 'public open fun id (x: T of .J.id?): T of .J.id? declared in .J' type=kotlin.Function0? origin=null - : kotlin.Function0? - x: GET_VAR 'a: kotlin.Function0 declared in .test8' type=kotlin.Function0 origin=null + CALL 'public open fun id (x: T of .J.id?): T of .J.id? declared in .J' type=kotlin.Function0? origin=null + : kotlin.Function0? + x: GET_VAR 'a: kotlin.Function0 declared in .test8' type=kotlin.Function0 origin=null FUN name:test9 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public open fun run1 (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/types/asOnPlatformType.fir.txt b/compiler/testData/ir/irText/types/asOnPlatformType.fir.txt new file mode 100644 index 00000000000..b89d778a113 --- /dev/null +++ b/compiler/testData/ir/irText/types/asOnPlatformType.fir.txt @@ -0,0 +1,23 @@ +FILE fqName: fileName:/asOnPlatformType.kt + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:nullStr type:kotlin.String? [val] + CALL 'public open fun nullString (): kotlin.String? declared in .JavaClass' type=kotlin.String? origin=null + VAR name:nonnullStr type:kotlin.String? [val] + CALL 'public open fun nonnullString (): kotlin.String? declared in .JavaClass' type=kotlin.String? origin=null + CALL 'public final fun foo (): T of .foo [inline] declared in ' type=kotlin.String? origin=null + CALL 'public final fun foo (): T of .foo [inline] declared in ' type=kotlin.String? origin=null + CALL 'public final fun fooN (): T of .fooN? [inline] declared in ' type=kotlin.String? origin=null + CALL 'public final fun fooN (): T of .fooN? [inline] declared in ' type=kotlin.String? origin=null + FUN name:foo visibility:public modality:FINAL () returnType:T of .foo [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): T of .foo [inline] declared in ' + TYPE_OP type=T of .foo origin=CAST typeOperand=T of .foo + ERROR_CALL 'Unresolved reference: this#' type=T of .foo + FUN name:fooN visibility:public modality:FINAL () returnType:T of .fooN? [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun fooN (): T of .fooN? [inline] declared in ' + TYPE_OP type=T of .fooN? origin=CAST typeOperand=T of .fooN? + ERROR_CALL 'Unresolved reference: this#' type=T of .fooN diff --git a/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.txt b/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.txt index 1b25680005a..1c39dbf83e9 100644 --- a/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.txt +++ b/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.fir.txt @@ -1,31 +1,37 @@ FILE fqName: fileName:/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.kt - FUN name:testPlatformEqualsPlatform visibility:public modality:FINAL <> () returnType:IrErrorType + FUN name:testPlatformEqualsPlatform visibility:public modality:FINAL <> () returnType:kotlin.Boolean BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsPlatform (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - FUN name:testPlatformEqualsKotlin visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsPlatform (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.Boolean origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + FUN name:testPlatformEqualsKotlin visibility:public modality:FINAL <> () returnType:kotlin.Boolean BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsKotlin (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Double type=kotlin.Double value=0.0 - FUN name:testKotlinEqualsPlatform visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsKotlin (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.Boolean origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + other: CONST Double type=kotlin.Double value=0.0 + FUN name:testKotlinEqualsPlatform visibility:public modality:FINAL <> () returnType:kotlin.Boolean BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testKotlinEqualsPlatform (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - FUN name:testPlatformCompareToPlatform visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun testKotlinEqualsPlatform (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.Boolean origin=null + $this: CONST Double type=kotlin.Double value=0.0 + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + FUN name:testPlatformCompareToPlatform visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToPlatform (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - FUN name:testPlatformCompareToKotlin visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToPlatform (): kotlin.Int declared in ' + CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + FUN name:testPlatformCompareToKotlin visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToKotlin (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Double type=kotlin.Double value=0.0 - FUN name:testKotlinCompareToPlatform visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToKotlin (): kotlin.Int declared in ' + CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + other: CONST Double type=kotlin.Double value=0.0 + FUN name:testKotlinCompareToPlatform visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testKotlinCompareToPlatform (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + RETURN type=kotlin.Nothing from='public final fun testKotlinCompareToPlatform (): kotlin.Int declared in ' + CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null + $this: CONST Double type=kotlin.Double value=0.0 + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null diff --git a/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.txt b/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.txt index a964ed2e968..9064f6f9bdb 100644 --- a/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.txt +++ b/compiler/testData/ir/irText/types/explicitEqualsAndCompareToCallsOnPlatformTypeReceiver.txt @@ -4,9 +4,8 @@ FILE fqName: fileName:/explicitEqualsAndCompareToCallsOnPlatformTypeReceiv BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsPlatform (): kotlin.Boolean declared in ' CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Double' type=kotlin.Boolean origin=null - $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testPlatformEqualsPlatform' type=.JavaClass origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testPlatformEqualsPlatform' type=.JavaClass origin=null other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null $this: GET_VAR ': .JavaClass declared in .testPlatformEqualsPlatform' type=.JavaClass origin=null FUN name:testPlatformEqualsKotlin visibility:public modality:FINAL <> ($receiver:.JavaClass) returnType:kotlin.Boolean @@ -14,9 +13,8 @@ FILE fqName: fileName:/explicitEqualsAndCompareToCallsOnPlatformTypeReceiv BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testPlatformEqualsKotlin (): kotlin.Boolean declared in ' CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Double' type=kotlin.Boolean origin=null - $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testPlatformEqualsKotlin' type=.JavaClass origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testPlatformEqualsKotlin' type=.JavaClass origin=null other: CONST Double type=kotlin.Double value=0.0 FUN name:testKotlinEqualsPlatform visibility:public modality:FINAL <> ($receiver:.JavaClass) returnType:kotlin.Boolean $receiver: VALUE_PARAMETER name: type:.JavaClass @@ -31,20 +29,17 @@ FILE fqName: fileName:/explicitEqualsAndCompareToCallsOnPlatformTypeReceiv BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToPlatform (): kotlin.Int declared in ' CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToPlatform' type=.JavaClass origin=null - other: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToPlatform' type=.JavaClass origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToPlatform' type=.JavaClass origin=null + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToPlatform' type=.JavaClass origin=null FUN name:testPlatformCompareToKotlin visibility:public modality:FINAL <> ($receiver:.JavaClass) returnType:kotlin.Int $receiver: VALUE_PARAMETER name: type:.JavaClass BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testPlatformCompareToKotlin (): kotlin.Int declared in ' CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToKotlin' type=.JavaClass origin=null + $this: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testPlatformCompareToKotlin' type=.JavaClass origin=null other: CONST Double type=kotlin.Double value=0.0 FUN name:testKotlinCompareToPlatform visibility:public modality:FINAL <> ($receiver:.JavaClass) returnType:kotlin.Int $receiver: VALUE_PARAMETER name: type:.JavaClass @@ -52,6 +47,5 @@ FILE fqName: fileName:/explicitEqualsAndCompareToCallsOnPlatformTypeReceiv RETURN type=kotlin.Nothing from='public final fun testKotlinCompareToPlatform (): kotlin.Int declared in ' CALL 'public open fun compareTo (other: kotlin.Double): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null $this: CONST Double type=kotlin.Double value=0.0 - other: TYPE_OP type=kotlin.Double origin=IMPLICIT_NOTNULL typeOperand=kotlin.Double - CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null - $this: GET_VAR ': .JavaClass declared in .testKotlinCompareToPlatform' type=.JavaClass origin=null + other: CALL 'public open fun null0 (): kotlin.Double? declared in .JavaClass' type=kotlin.Double? origin=null + $this: GET_VAR ': .JavaClass declared in .testKotlinCompareToPlatform' type=.JavaClass origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType1_NI.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.txt index d5586af773b..7aa3aa0029a 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_NI.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.txt @@ -37,10 +37,8 @@ FILE fqName: fileName:/intersectionType1_NI.kt $receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=.In origin=GET_ARRAY_ELEMENT $this: CALL 'public final fun select (x: S of .select, y: S of .select): S of .select declared in ' type=kotlin.Array.In> origin=null : kotlin.Array.In> - x: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> - GET_VAR 'a: kotlin.Array<.In.foo>> declared in .foo' type=kotlin.Array<.In.foo>> origin=null - y: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> - GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null + x: GET_VAR 'a: kotlin.Array<.In.foo>> declared in .foo' type=kotlin.Array<.In.foo>> origin=null + y: GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null index: CONST Int type=kotlin.Int value=0 y: CONST Boolean type=kotlin.Boolean value=true FUN name:ofType visibility:public modality:FINAL ($receiver:.In.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline] diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt index d1904d14e44..0eeb95e4b23 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/intersectionType1_OI.kt CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In TYPE_PARAMETER name:I index:0 variance:in superTypes:[] - CONSTRUCTOR visibility:public <> () returnType:.In.In> [primary] + CONSTRUCTOR visibility:public <> () returnType:.In> [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]' @@ -43,13 +43,15 @@ FILE fqName: fileName:/intersectionType1_OI.kt GET_VAR 'y: kotlin.Any? declared in .ofType' type=kotlin.Any? origin=null FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:a1 type:kotlin.Array> [val] - CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array> origin=null - elements: CALL 'public constructor () [primary] declared in .In' type=.In.In> origin=null - VAR name:a2 type:kotlin.Array> [val] - CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array> origin=null - elements: CALL 'public constructor () [primary] declared in .In' type=.In.In> origin=null + VAR name:a1 type:kotlin.Array<.In> [val] + CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array<.In> origin=null + elements: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .In' type=.In origin=null + : + VAR name:a2 type:kotlin.Array<.In> [val] + CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array<.In> origin=null + elements: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .In' type=.In origin=null + : CALL 'public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' type=kotlin.Boolean origin=null : - a: GET_VAR 'val a1: kotlin.Array> [val] declared in .test' type=kotlin.Array> origin=null - b: GET_VAR 'val a2: kotlin.Array> [val] declared in .test' type=kotlin.Array> origin=null + a: GET_VAR 'val a1: kotlin.Array<.In> [val] declared in .test' type=kotlin.Array<.In> origin=null + b: GET_VAR 'val a2: kotlin.Array<.In> [val] declared in .test' type=kotlin.Array<.In> origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.txt index bc693b29242..23eff76d1d9 100644 --- a/compiler/testData/ir/irText/types/intersectionType1_OI.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.txt @@ -37,10 +37,8 @@ FILE fqName: fileName:/intersectionType1_OI.kt $receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=.In origin=GET_ARRAY_ELEMENT $this: CALL 'public final fun select (x: S of .select, y: S of .select): S of .select declared in ' type=kotlin.Array.In> origin=null : kotlin.Array.In> - x: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> - GET_VAR 'a: kotlin.Array<.In.foo>> declared in .foo' type=kotlin.Array<.In.foo>> origin=null - y: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> - GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null + x: GET_VAR 'a: kotlin.Array<.In.foo>> declared in .foo' type=kotlin.Array<.In.foo>> origin=null + y: GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null index: CONST Int type=kotlin.Int value=0 y: CONST Boolean type=kotlin.Boolean value=true FUN name:ofType visibility:public modality:FINAL ($receiver:.In.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline] diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt index 42150bbe4c7..0cf45e1b37a 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt @@ -68,33 +68,31 @@ FILE fqName: fileName:/intersectionType2_OI.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0) returnType:IrErrorType + FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0.run>) returnType:IrErrorType TYPE_PARAMETER name:T index:0 variance: superTypes:[] - VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0.run> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun run (fn: kotlin.Function0): IrErrorType declared in ' + RETURN type=kotlin.Nothing from='public final fun run (fn: kotlin.Function0.run>): IrErrorType declared in ' ERROR_CALL 'Unresolved reference: #' type=IrErrorType FUN name:foo visibility:public modality:FINAL <> () returnType:IrErrorType BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (): IrErrorType declared in ' - CALL 'public final fun run (fn: kotlin.Function0): IrErrorType declared in ' type=IrErrorType origin=null + CALL 'public final fun run (fn: kotlin.Function0.run>): IrErrorType declared in ' type=IrErrorType origin=null : fn: BLOCK type=IrErrorType origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:IrErrorType BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): IrErrorType declared in .foo' - BLOCK type=.B origin=null - VAR name:mm type:.B [val] - CALL 'public constructor () [primary] declared in .B' type=.B origin=null - VAR name:nn type:.C [val] - CALL 'public constructor () [primary] declared in .C' type=.C origin=null - VAR name:c type:.B [val] - WHEN type=.B origin=IF - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val mm: .B [val] declared in .foo.' type=.B origin=null - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val nn: .C [val] declared in .foo.' type=.C origin=null - GET_VAR 'val c: .B [val] declared in .foo.' type=.B origin=null + VAR name:mm type:IrErrorType [val] + ERROR_CALL 'Unresolved reference: B#' type=IrErrorType + VAR name:nn type:IrErrorType [val] + ERROR_CALL 'Unresolved reference: C#' type=IrErrorType + VAR name:c type:IrErrorType [val] + WHEN type=IrErrorType origin=IF + BRANCH + if: CONST Boolean type=IrErrorType value=true + then: ERROR_CALL 'Unresolved reference: mm#' type=IrErrorType + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: ERROR_CALL 'Unresolved reference: nn#' type=IrErrorType + ERROR_CALL 'Unresolved reference: c#' type=IrErrorType FUNCTION_REFERENCE 'local final fun (): IrErrorType declared in .foo' type=IrErrorType origin=LAMBDA diff --git a/compiler/testData/ir/irText/types/intersectionType3_NI.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.txt index 2e0312403b5..99fead62fa9 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_NI.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.txt @@ -141,10 +141,8 @@ FILE fqName: fileName:/intersectionType3_NI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null + x: GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null + y: GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean VALUE_PARAMETER name:x index:0 type:.In<.Z1> VALUE_PARAMETER name:y index:1 type:.In<.Z2> @@ -154,10 +152,8 @@ FILE fqName: fileName:/intersectionType3_NI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null + x: GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null + y: GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean VALUE_PARAMETER name:x index:0 type:.In<.A1> VALUE_PARAMETER name:y index:1 type:.In<.A2> @@ -167,10 +163,8 @@ FILE fqName: fileName:/intersectionType3_NI.kt : .A $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null : .In<.A> - x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null - y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null + x: GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null + y: GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.A> VALUE_PARAMETER name:y index:1 type:.In<.B> @@ -180,10 +174,8 @@ FILE fqName: fileName:/intersectionType3_NI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null + x: GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null + y: GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.Z1> VALUE_PARAMETER name:y index:1 type:.In<.Z2> @@ -193,10 +185,8 @@ FILE fqName: fileName:/intersectionType3_NI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null + x: GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null + y: GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.A1> VALUE_PARAMETER name:y index:1 type:.In<.A2> @@ -206,7 +196,5 @@ FILE fqName: fileName:/intersectionType3_NI.kt : .A $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null : .In<.A> - x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'x: .In<.A1> declared in .testInAs3' type=.In<.A1> origin=null - y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'y: .In<.A2> declared in .testInAs3' type=.In<.A2> origin=null + x: GET_VAR 'x: .In<.A1> declared in .testInAs3' type=.In<.A1> origin=null + y: GET_VAR 'y: .In<.A2> declared in .testInAs3' type=.In<.A2> origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.txt index 814dd2a9da9..64aeb55de7f 100644 --- a/compiler/testData/ir/irText/types/intersectionType3_OI.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.txt @@ -141,10 +141,8 @@ FILE fqName: fileName:/intersectionType3_OI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null + x: GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null + y: GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean VALUE_PARAMETER name:x index:0 type:.In<.Z1> VALUE_PARAMETER name:y index:1 type:.In<.Z2> @@ -154,10 +152,8 @@ FILE fqName: fileName:/intersectionType3_OI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null + x: GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null + y: GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean VALUE_PARAMETER name:x index:0 type:.In<.A1> VALUE_PARAMETER name:y index:1 type:.In<.A2> @@ -167,10 +163,8 @@ FILE fqName: fileName:/intersectionType3_OI.kt : .A $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null : .In<.A> - x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null - y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null + x: GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null + y: GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.A> VALUE_PARAMETER name:y index:1 type:.In<.B> @@ -180,10 +174,8 @@ FILE fqName: fileName:/intersectionType3_OI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null + x: GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null + y: GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.Z1> VALUE_PARAMETER name:y index:1 type:.In<.Z2> @@ -193,10 +185,8 @@ FILE fqName: fileName:/intersectionType3_OI.kt : kotlin.Any $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null : .In - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null + x: GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null + y: GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.In<.A1> VALUE_PARAMETER name:y index:1 type:.In<.A2> @@ -206,7 +196,5 @@ FILE fqName: fileName:/intersectionType3_OI.kt : .A $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null : .In<.A> - x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'x: .In<.A1> declared in .testInAs3' type=.In<.A1> origin=null - y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> - GET_VAR 'y: .In<.A2> declared in .testInAs3' type=.In<.A2> origin=null + x: GET_VAR 'x: .In<.A1> declared in .testInAs3' type=.In<.A1> origin=null + y: GET_VAR 'y: .In<.A2> declared in .testInAs3' type=.In<.A2> origin=null diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt index b80763b22ac..b34227ee7d6 100644 --- a/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt @@ -95,37 +95,27 @@ FILE fqName: fileName:/localVariableOfIntersectionType_NI.kt VALUE_PARAMETER name:z index:2 type:.Z BLOCK_BODY CALL 'public abstract fun foo (): kotlin.Unit declared in .IA' type=kotlin.Unit origin=null - $this: TYPE_OP type=.IA origin=IMPLICIT_CAST typeOperand=.IA - CALL 'public abstract fun (): T of .Inv declared in .Inv' type=kotlin.Any origin=GET_PROPERTY - $this: CALL 'public abstract fun create (x: .In.Z.create>, y: .In.Z.create>): .Inv.Z.create> declared in .Z' type=.Inv origin=null - : kotlin.Any - $this: GET_VAR 'z: .Z declared in .test' type=.Z origin=null - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null + $this: CALL 'public abstract fun (): T of .Inv declared in .Inv' type=kotlin.Any origin=GET_PROPERTY + $this: CALL 'public abstract fun create (x: .In.Z.create>, y: .In.Z.create>): .Inv.Z.create> declared in .Z' type=.Inv origin=null + : kotlin.Any + $this: GET_VAR 'z: .Z declared in .test' type=.Z origin=null + x: GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null + y: GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null CALL 'public abstract fun bar (): kotlin.Unit declared in .IB' type=kotlin.Unit origin=null - $this: TYPE_OP type=.IB origin=IMPLICIT_CAST typeOperand=.IB - CALL 'public abstract fun (): T of .Inv declared in .Inv' type=kotlin.Any origin=GET_PROPERTY - $this: CALL 'public abstract fun create (x: .In.Z.create>, y: .In.Z.create>): .Inv.Z.create> declared in .Z' type=.Inv origin=null - : kotlin.Any - $this: GET_VAR 'z: .Z declared in .test' type=.Z origin=null - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null + $this: CALL 'public abstract fun (): T of .Inv declared in .Inv' type=kotlin.Any origin=GET_PROPERTY + $this: CALL 'public abstract fun create (x: .In.Z.create>, y: .In.Z.create>): .Inv.Z.create> declared in .Z' type=.Inv origin=null + : kotlin.Any + $this: GET_VAR 'z: .Z declared in .test' type=.Z origin=null + x: GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null + y: GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null VAR name:t type:kotlin.Any [val] CALL 'public abstract fun (): T of .Inv declared in .Inv' type=kotlin.Any origin=GET_PROPERTY $this: CALL 'public abstract fun create (x: .In.Z.create>, y: .In.Z.create>): .Inv.Z.create> declared in .Z' type=.Inv origin=null : kotlin.Any $this: GET_VAR 'z: .Z declared in .test' type=.Z origin=null - x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null - y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In - GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null + x: GET_VAR 'a: .In<.IA> declared in .test' type=.In<.IA> origin=null + y: GET_VAR 'b: .In<.IB> declared in .test' type=.In<.IB> origin=null CALL 'public abstract fun foo (): kotlin.Unit declared in .IA' type=kotlin.Unit origin=null - $this: TYPE_OP type=.IA origin=IMPLICIT_CAST typeOperand=.IA - GET_VAR 'val t: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null + $this: GET_VAR 'val t: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null CALL 'public abstract fun bar (): kotlin.Unit declared in .IB' type=kotlin.Unit origin=null - $this: TYPE_OP type=.IB origin=IMPLICIT_CAST typeOperand=.IB - GET_VAR 'val t: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null + $this: GET_VAR 'val t: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.fir.txt b/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.fir.txt index 6451859a7c9..c349752acca 100644 --- a/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.fir.txt +++ b/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.fir.txt @@ -29,3 +29,4 @@ FILE fqName: fileName:/nullabilityAssertionOnExtensionReceiver.kt FUN name:testMemberExt visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun memberExtension (): kotlin.Unit declared in .C' type=kotlin.Unit origin=null + $this: CALL 'public open fun s (): kotlin.String? declared in .J' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.txt b/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.txt index 27054f3629f..b04dfc4286a 100644 --- a/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.txt +++ b/compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.txt @@ -28,12 +28,10 @@ FILE fqName: fileName:/nullabilityAssertionOnExtensionReceiver.kt FUN name:testExt visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun extension (): kotlin.Unit declared in ' type=kotlin.Unit origin=null - $receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun s (): kotlin.String? declared in .J' type=kotlin.String? origin=null + $receiver: CALL 'public open fun s (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:testMemberExt visibility:public modality:FINAL <> ($receiver:.C) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.C BLOCK_BODY CALL 'public final fun memberExtension (): kotlin.Unit declared in .C' type=kotlin.Unit origin=null $this: GET_VAR ': .C declared in .testMemberExt' type=.C origin=null - $receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun s (): kotlin.String? declared in .J' type=kotlin.String? origin=null + $receiver: CALL 'public open fun s (): kotlin.String? declared in .J' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/types/platformTypeReceiver.fir.txt b/compiler/testData/ir/irText/types/platformTypeReceiver.fir.txt new file mode 100644 index 00000000000..1351589ad77 --- /dev/null +++ b/compiler/testData/ir/irText/types/platformTypeReceiver.fir.txt @@ -0,0 +1,13 @@ +FILE fqName: fileName:/platformTypeReceiver.kt + FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:BOOL_NULL type:kotlin.Boolean? visibility:public [static] ' type=kotlin.Boolean? origin=GET_PROPERTY + other: CONST Null type=kotlin.Nothing? value=null + FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.Boolean origin=null + $this: CALL 'public open fun boolNull (): kotlin.Boolean? declared in .J' type=kotlin.Boolean? origin=null + other: CONST Null type=kotlin.Nothing? value=null diff --git a/compiler/testData/ir/irText/types/platformTypeReceiver.kt b/compiler/testData/ir/irText/types/platformTypeReceiver.kt new file mode 100644 index 00000000000..6130fda8ddd --- /dev/null +++ b/compiler/testData/ir/irText/types/platformTypeReceiver.kt @@ -0,0 +1,9 @@ +// FILE: J.java +public class J { + public static Boolean BOOL_NULL = null; + public static Boolean boolNull() { return null; } +} + +// FILE: platformTypeReceiver.kt +fun test1() = J.BOOL_NULL.equals(null) +fun test2() = J.boolNull().equals(null) diff --git a/compiler/testData/ir/irText/types/platformTypeReceiver.txt b/compiler/testData/ir/irText/types/platformTypeReceiver.txt new file mode 100644 index 00000000000..cb8e4319afa --- /dev/null +++ b/compiler/testData/ir/irText/types/platformTypeReceiver.txt @@ -0,0 +1,13 @@ +FILE fqName: fileName:/platformTypeReceiver.kt + FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null + $this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:BOOL_NULL type:kotlin.Boolean? visibility:public [static] ' type=kotlin.Boolean? origin=GET_PROPERTY + other: CONST Null type=kotlin.Nothing? value=null + FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Boolean declared in ' + CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null + $this: CALL 'public open fun boolNull (): kotlin.Boolean? declared in .J' type=kotlin.Boolean? origin=null + other: CONST Null type=kotlin.Nothing? value=null diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.txt new file mode 100644 index 00000000000..c6965c6a84f --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.fir.txt @@ -0,0 +1,17 @@ +FILE fqName: fileName:/smartCastOnFieldReceiverOfGenericType.kt + FUN name:testSetField visibility:public modality:FINAL <> (a:kotlin.Any, b:kotlin.Any) returnType:kotlin.Unit + VALUE_PARAMETER name:a index:0 type:kotlin.Any + VALUE_PARAMETER name:b index:1 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=.JCell origin=CAST typeOperand=.JCell + GET_VAR 'a: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + GET_VAR 'b: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN name:testGetField visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.String + VALUE_PARAMETER name:a index:0 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=.JCell origin=CAST typeOperand=.JCell + GET_VAR 'a: kotlin.Any declared in .testGetField' type=kotlin.Any origin=null + RETURN type=kotlin.Nothing from='public final fun testGetField (a: kotlin.Any): kotlin.String declared in ' + ERROR_CALL 'Unresolved reference: #' type=IrErrorType diff --git a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.txt b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.txt index d0e74226598..9acbb1a8c4c 100644 --- a/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.txt +++ b/compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.txt @@ -10,9 +10,8 @@ FILE fqName: fileName:/smartCastOnFieldReceiverOfGenericType.kt TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String GET_VAR 'b: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:T of .JCell? visibility:public ' type=kotlin.Unit origin=EQ - receiver: TYPE_OP type=.JCell origin=IMPLICIT_CAST typeOperand=.JCell - GET_VAR 'a: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null - value: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String + receiver: GET_VAR 'a: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null + value: TYPE_OP type=T of .JCell origin=IMPLICIT_CAST typeOperand=T of .JCell GET_VAR 'b: kotlin.Any declared in .testSetField' type=kotlin.Any origin=null FUN name:testGetField visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.String VALUE_PARAMETER name:a index:0 type:kotlin.Any @@ -21,7 +20,5 @@ FILE fqName: fileName:/smartCastOnFieldReceiverOfGenericType.kt TYPE_OP type=.JCell origin=CAST typeOperand=.JCell GET_VAR 'a: kotlin.Any declared in .testGetField' type=kotlin.Any origin=null RETURN type=kotlin.Nothing from='public final fun testGetField (a: kotlin.Any): kotlin.String declared in ' - TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:T of .JCell? visibility:public ' type=kotlin.String? origin=GET_PROPERTY - receiver: TYPE_OP type=.JCell origin=IMPLICIT_CAST typeOperand=.JCell - GET_VAR 'a: kotlin.Any declared in .testGetField' type=kotlin.Any origin=null + GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:T of .JCell? visibility:public ' type=kotlin.String? origin=GET_PROPERTY + receiver: GET_VAR 'a: kotlin.Any declared in .testGetField' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.fir.txt b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.fir.txt new file mode 100644 index 00000000000..510a771c187 --- /dev/null +++ b/compiler/testData/ir/irText/types/smartCastOnReceiverOfGenericType.fir.txt @@ -0,0 +1,130 @@ +FILE fqName: fileName:/smartCastOnReceiverOfGenericType.kt + FUN name:testFunction visibility:public modality:FINAL <> (a:kotlin.Any, b:kotlin.Any) returnType:kotlin.Unit + VALUE_PARAMETER name:a index:0 type:kotlin.Any + VALUE_PARAMETER name:b index:1 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList + GET_VAR 'a: kotlin.Any declared in .testFunction' type=kotlin.Any origin=null + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + GET_VAR 'b: kotlin.Any declared in .testFunction' type=kotlin.Any origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'b: kotlin.Any declared in .testFunction' type=kotlin.Any origin=null + FUN name:testProperty visibility:public modality:FINAL <> (a:kotlin.Any, b:kotlin.Any) returnType:kotlin.Unit + VALUE_PARAMETER name:a index:0 type:kotlin.Any + VALUE_PARAMETER name:b index:1 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=.Cell origin=CAST typeOperand=.Cell + GET_VAR 'a: kotlin.Any declared in .testProperty' type=kotlin.Any origin=null + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + GET_VAR 'b: kotlin.Any declared in .testProperty' type=kotlin.Any origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN name:testInnerClass visibility:public modality:FINAL <> (a:kotlin.Any, b:kotlin.Any, c:kotlin.Any) returnType:kotlin.Unit + VALUE_PARAMETER name:a index:0 type:kotlin.Any + VALUE_PARAMETER name:b index:1 type:kotlin.Any + VALUE_PARAMETER name:c index:2 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=.Outer.Inner origin=CAST typeOperand=.Outer.Inner + GET_VAR 'a: kotlin.Any declared in .testInnerClass' type=kotlin.Any origin=null + TYPE_OP type=kotlin.Int origin=CAST typeOperand=kotlin.Int + GET_VAR 'b: kotlin.Any declared in .testInnerClass' type=kotlin.Any origin=null + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + GET_VAR 'c: kotlin.Any declared in .testInnerClass' type=kotlin.Any origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'b: kotlin.Any declared in .testInnerClass' type=kotlin.Any origin=null + GET_VAR 'c: kotlin.Any declared in .testInnerClass' type=kotlin.Any origin=null + FUN name:testNonSubstitutedTypeParameter visibility:public modality:FINAL (a:kotlin.Any, b:kotlin.Any) returnType:kotlin.Unit + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + VALUE_PARAMETER name:a index:0 type:kotlin.Any + VALUE_PARAMETER name:b index:1 type:kotlin.Any + BLOCK_BODY + TYPE_OP type=kotlin.collections.MutableList.testNonSubstitutedTypeParameter>> origin=CAST typeOperand=kotlin.collections.MutableList.testNonSubstitutedTypeParameter>> + GET_VAR 'a: kotlin.Any declared in .testNonSubstitutedTypeParameter' type=kotlin.Any origin=null + TYPE_OP type=kotlin.collections.List.testNonSubstitutedTypeParameter> origin=CAST typeOperand=kotlin.collections.List.testNonSubstitutedTypeParameter> + GET_VAR 'b: kotlin.Any declared in .testNonSubstitutedTypeParameter' type=kotlin.Any origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'b: kotlin.Any declared in .testNonSubstitutedTypeParameter' type=kotlin.Any origin=null + CLASS CLASS name:Cell modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Cell + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + CONSTRUCTOR visibility:public <> (value:T of ) returnType:.Cell> [primary] + VALUE_PARAMETER name:value index:0 type:T of + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Cell modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:value visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:value type:T of .Cell visibility:public + EXPRESSION_BODY + GET_VAR 'value: T of declared in .Cell.' type=T of origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Cell) returnType:T of .Cell + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.Cell + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Cell declared in .Cell' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .Cell visibility:public ' type=T of .Cell origin=null + receiver: GET_VAR ': .Cell declared in .Cell.' type=.Cell origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Cell, :T of .Cell) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.Cell + VALUE_PARAMETER name: index:0 type:T of .Cell + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .Cell visibility:public ' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Cell declared in .Cell.' type=.Cell origin=null + value: GET_VAR ': T of .Cell declared in .Cell.' type=T of .Cell origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer + TYPE_PARAMETER name:T1 index:0 variance: superTypes:[] + CONSTRUCTOR visibility:public <> () returnType:.Outer> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer.Inner + TYPE_PARAMETER name:T2 index:0 variance: superTypes:[] + CONSTRUCTOR visibility:public <> () returnType:.Outer.Inner> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' + FUN name:use visibility:public modality:FINAL <> ($this:.Outer.Inner, x1:T1 of .Outer, x2:T2 of .Outer.Inner) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Outer.Inner + VALUE_PARAMETER name:x1 index:0 type:T1 of .Outer + VALUE_PARAMETER name:x2 index:1 type:T2 of .Outer.Inner + BLOCK_BODY + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 3d8cf884cc6..29ee1f62c05 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1656,6 +1656,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/types/nullabilityAssertionOnExtensionReceiver.kt"); } + @TestMetadata("platformTypeReceiver.kt") + public void testPlatformTypeReceiver() throws Exception { + runTest("compiler/testData/ir/irText/types/platformTypeReceiver.kt"); + } + @TestMetadata("smartCastOnFieldReceiverOfGenericType.kt") public void testSmartCastOnFieldReceiverOfGenericType() throws Exception { runTest("compiler/testData/ir/irText/types/smartCastOnFieldReceiverOfGenericType.kt");