diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index d96ad2b864c..46359257ca8 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.backend import com.intellij.psi.PsiCompiledElement import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.FirElement @@ -41,6 +42,7 @@ import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.ir.util.functions import org.jetbrains.kotlin.ir.util.isFakeOverride +import org.jetbrains.kotlin.ir.util.properties import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments @@ -472,6 +474,7 @@ fun FirClass<*>.getSamIfAny(): FirSimpleFunction? = val IrType.isSamType: Boolean get() { val irClass = classOrNull ?: return false + if (irClass.owner.kind != ClassKind.INTERFACE) return false val am = irClass.functions.singleOrNull { it.owner.modality == Modality.ABSTRACT } return am != null } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index bdcee655bc4..d14166e4ee2 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -17,6 +17,8 @@ import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.references.FirSuperReference import org.jetbrains.kotlin.fir.render +import org.jetbrains.kotlin.fir.resolve.calls.isExtensionFunctionType +import org.jetbrains.kotlin.fir.resolve.calls.isFunctional import org.jetbrains.kotlin.fir.resolve.inference.isBuiltinFunctionalType import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol @@ -27,10 +29,7 @@ import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrProperty -import org.jetbrains.kotlin.ir.expressions.IrErrorCallExpression -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.IrTypeOperator +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.types.* @@ -417,17 +416,24 @@ internal class CallAndReferenceGenerator( argument: FirExpression, parameter: FirValueParameter? ): IrExpression { - if (parameter == null || - parameter.returnTypeRef.coneTypeSafe()?.isBuiltinFunctionalType(session) == true - ) return this - if (argument !is FirLambdaArgumentExpression) return this - if (argument.expression !is FirAnonymousFunction) return this - if (argument.expression.typeRef == parameter.returnTypeRef) return this + if (parameter == null || !needSamConversion(argument, parameter)) { + return this + } val samType = parameter.returnTypeRef.toIrType() + // Make sure the converted IrType owner indeed has a single abstract method, since FunctionReferenceLowering relies on it. if (!samType.isSamType) return this return IrTypeOperatorCallImpl(this.startOffset, this.endOffset, samType, IrTypeOperator.SAM_CONVERSION, samType, this) } + private fun needSamConversion(argument: FirExpression, parameter: FirValueParameter): Boolean { + // If the expected type is a built-in functional type, we don't need SAM conversion. + if (parameter.returnTypeRef.coneTypeSafe()?.isBuiltinFunctionalType(session) == true) { + return false + } + // On the other hand, the actual type should be a functional type. + return argument.isFunctional(session) + } + private fun IrExpression.applyTypeArguments(access: FirQualifiedAccess): IrExpression { return when (this) { is IrMemberAccessExpressionBase -> { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index cb0513f11da..bcd43e8ad0a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -31,7 +31,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.SimpleConstraintSystem import org.jetbrains.kotlin.types.model.CaptureStatus import org.jetbrains.kotlin.utils.addToStdlib.safeAs - fun Candidate.resolveArgumentExpression( /* csBuilder: ConstraintSystemBuilder, @@ -310,11 +309,7 @@ private fun Candidate.getExpectedTypeWithSAMConversion( val firFunction = symbol.fir as? FirFunction<*> ?: return null if (!samResolver.shouldRunSamConversionForFunction(firFunction)) return null - val argumentIsFunctional = when ((argument as? FirWrappedArgumentExpression)?.expression ?: argument) { - is FirAnonymousFunction, is FirCallableReferenceAccess -> true - else -> argument.typeRef.coneTypeSafe()?.isBuiltinFunctionalType(session) == true - } - if (!argumentIsFunctional) return null + if (!argument.isFunctional(session)) return null // TODO: resolvedCall.registerArgumentWithSamConversion(argument, SamConversionDescription(convertedTypeByOriginal, convertedTypeByCandidate!!)) @@ -323,6 +318,12 @@ private fun Candidate.getExpectedTypeWithSAMConversion( } ?: return null } +fun FirExpression.isFunctional(session: FirSession): Boolean = + when ((this as? FirWrappedArgumentExpression)?.expression ?: this) { + is FirAnonymousFunction, is FirCallableReferenceAccess -> true + else -> typeRef.coneTypeSafe()?.isBuiltinFunctionalType(session) == true + } + internal fun FirExpression.getExpectedType( session: FirSession, parameter: FirValueParameter/*, languageVersionSettings: LanguageVersionSettings*/ @@ -340,7 +341,6 @@ internal fun FirExpression.getExpectedType( } } - fun ConeKotlinType.varargElementType(session: FirSession): ConeKotlinType { return this.arrayElementType(session) ?: error("Failed to extract! ${this.render()}!") } diff --git a/compiler/testData/codegen/box/annotations/annotatedLambda/samLambda.kt b/compiler/testData/codegen/box/annotations/annotatedLambda/samLambda.kt index 45b1a1a915b..7d5fecf3740 100644 --- a/compiler/testData/codegen/box/annotations/annotatedLambda/samLambda.kt +++ b/compiler/testData/codegen/box/annotations/annotatedLambda/samLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/funInterface/partialSam.kt b/compiler/testData/codegen/box/funInterface/partialSam.kt index 891493ca9f6..0ec67f087a0 100644 --- a/compiler/testData/codegen/box/funInterface/partialSam.kt +++ b/compiler/testData/codegen/box/funInterface/partialSam.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // SKIP_DCE_DRIVEN diff --git a/compiler/testData/codegen/box/funInterface/receiverEvaluatedOnce.kt b/compiler/testData/codegen/box/funInterface/receiverEvaluatedOnce.kt index 10f627d4a2e..9de5c1e8b20 100644 --- a/compiler/testData/codegen/box/funInterface/receiverEvaluatedOnce.kt +++ b/compiler/testData/codegen/box/funInterface/receiverEvaluatedOnce.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // SKIP_DCE_DRIVEN diff --git a/compiler/testData/codegen/box/funInterface/suspendFunInterfaceConversionCodegen.kt b/compiler/testData/codegen/box/funInterface/suspendFunInterfaceConversionCodegen.kt index b8170373ef9..124d76de391 100644 --- a/compiler/testData/codegen/box/funInterface/suspendFunInterfaceConversionCodegen.kt +++ b/compiler/testData/codegen/box/funInterface/suspendFunInterfaceConversionCodegen.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions -// IGNORE_BACKEND_FIR: JVM_IR // WITH_COROUTINES // WITH_RUNTIME // SKIP_DCE_DRIVEN diff --git a/compiler/testData/codegen/box/inference/builderInference.kt b/compiler/testData/codegen/box/inference/builderInference.kt index bdcc0a56bea..d790f1d91e6 100644 --- a/compiler/testData/codegen/box/inference/builderInference.kt +++ b/compiler/testData/codegen/box/inference/builderInference.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // !LANGUAGE: +NewInference diff --git a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt index 2945f152bcd..493b7a30070 100644 --- a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt +++ b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt @@ -1,5 +1,4 @@ // !LANGUAGE: -NewInference -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: example/Hello.java diff --git a/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt b/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt index c092b5c129c..a89030a4d27 100644 --- a/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt +++ b/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // SKIP_JDK6 // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/sam/receiverEvaluatedOnce.kt b/compiler/testData/codegen/box/sam/receiverEvaluatedOnce.kt index eac268fb0eb..18842a303b0 100644 --- a/compiler/testData/codegen/box/sam/receiverEvaluatedOnce.kt +++ b/compiler/testData/codegen/box/sam/receiverEvaluatedOnce.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: JavaRunner.java diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt index 56e08be7e7b..0338d5f43dd 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt @@ -118,11 +118,13 @@ FILE fqName: fileName:/caoWithAdaptationForSam.kt GET_VAR 'fn: kotlin.Function1 declared in .test3' type=kotlin.Function1 origin=null CALL 'public final fun set (i: .IFoo, newValue: kotlin.Int): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test3' type=.A origin=null - i: GET_VAR 'val tmp_1: kotlin.Function1 [val] declared in .test3' type=kotlin.Function1 origin=null + i: TYPE_OP type=.IFoo origin=SAM_CONVERSION typeOperand=.IFoo + GET_VAR 'val tmp_1: kotlin.Function1 [val] declared in .test3' type=kotlin.Function1 origin=null newValue: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: CALL 'public final fun get (i: .IFoo): kotlin.Int [operator] declared in ' type=kotlin.Int origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test3' type=.A origin=null - i: GET_VAR 'val tmp_1: kotlin.Function1 [val] declared in .test3' type=kotlin.Function1 origin=null + i: TYPE_OP type=.IFoo origin=SAM_CONVERSION typeOperand=.IFoo + GET_VAR 'val tmp_1: kotlin.Function1 [val] declared in .test3' type=kotlin.Function1 origin=null other: CONST Int type=kotlin.Int value=1 FUN name:test4 visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Unit VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 @@ -160,11 +162,13 @@ FILE fqName: fileName:/caoWithAdaptationForSam.kt GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null CALL 'public final fun set (i: .IFoo, newValue: kotlin.Int): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR 'val tmp_4: .A [val] declared in .test5' type=.A origin=null - i: GET_VAR 'val tmp_5: kotlin.Function1 [val] declared in .test5' type=kotlin.Function1 origin=null + i: TYPE_OP type=.IFoo origin=SAM_CONVERSION typeOperand=.IFoo + GET_VAR 'val tmp_5: kotlin.Function1 [val] declared in .test5' type=kotlin.Function1 origin=null newValue: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: CALL 'public final fun get (i: .IFoo): kotlin.Int [operator] declared in ' type=kotlin.Int origin=null $receiver: GET_VAR 'val tmp_4: .A [val] declared in .test5' type=.A origin=null - i: GET_VAR 'val tmp_5: kotlin.Function1 [val] declared in .test5' type=kotlin.Function1 origin=null + i: TYPE_OP type=.IFoo origin=SAM_CONVERSION typeOperand=.IFoo + GET_VAR 'val tmp_5: kotlin.Function1 [val] declared in .test5' type=kotlin.Function1 origin=null other: CONST Int type=kotlin.Int value=1 FUN name:test6 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt index f531ceb2eb5..beb3175f117 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt @@ -32,28 +32,32 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument_fi.kt VALUE_PARAMETER name:arr index:3 type:kotlin.Array BLOCK_BODY CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null s: VARARG type=kotlin.Array varargElementType=kotlin.String GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null s: VARARG type=kotlin.Array varargElementType=kotlin.String SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null @@ -67,67 +71,77 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument_fi.kt SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit s: VARARG type=kotlin.Array varargElementType=kotlin.String SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt index 9360156a158..b439e09d60a 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt @@ -150,12 +150,13 @@ FILE fqName: fileName:/partialSam.kt CONST String type=kotlin.String value="" CALL 'public final fun runConversion (f1: .Fn, f2: .Fn): kotlin.Int declared in .J' type=kotlin.Int origin=null $this: GET_VAR 'j: .J declared in .test' type=.J origin=null - f1: FUN_EXPR type=kotlin.Function3 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (s:kotlin.String, i:kotlin.Int, ts:kotlin.String) returnType:kotlin.Int - VALUE_PARAMETER name:s index:0 type:kotlin.String - VALUE_PARAMETER name:i index:1 type:kotlin.Int - VALUE_PARAMETER name:ts index:2 type:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (s: kotlin.String, i: kotlin.Int, ts: kotlin.String): kotlin.Int declared in .test' - CONST Int type=kotlin.Int value=1 + f1: TYPE_OP type=.Fn origin=SAM_CONVERSION typeOperand=.Fn + FUN_EXPR type=kotlin.Function3 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (s:kotlin.String, i:kotlin.Int, ts:kotlin.String) returnType:kotlin.Int + VALUE_PARAMETER name:s index:0 type:kotlin.String + VALUE_PARAMETER name:i index:1 type:kotlin.Int + VALUE_PARAMETER name:ts index:2 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (s: kotlin.String, i: kotlin.Int, ts: kotlin.String): kotlin.Int declared in .test' + CONST Int type=kotlin.Int value=1 f2: CALL 'public final fun (): .fis. declared in ' type=.fis. origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt index e3c97644522..47cc1cd3102 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt @@ -39,7 +39,8 @@ FILE fqName: fileName:/samConversionOnCallableReference.kt FUN name:testSamConversion visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun use (r: .KRunnable): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: FUNCTION_REFERENCE 'public final fun foo0 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + r: TYPE_OP type=.KRunnable origin=SAM_CONVERSION typeOperand=.KRunnable + FUNCTION_REFERENCE 'public final fun foo0 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= FUN name:testSamConversionOnAdapted visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt index d33fc8e011b..6664533d3c8 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt @@ -76,7 +76,8 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt then: CALL 'public final fun run2 (r1: .KRunnable, r2: .KRunnable): kotlin.Unit declared in ' type=kotlin.Unit origin=null r1: TYPE_OP type=.KRunnable origin=IMPLICIT_CAST typeOperand=.KRunnable GET_VAR 'a: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null - r2: GET_VAR 'b: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null + r2: TYPE_OP type=.KRunnable origin=SAM_CONVERSION typeOperand=.KRunnable + GET_VAR 'b: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY @@ -107,16 +108,19 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt TYPE_OP type=kotlin.Function0 origin=CAST typeOperand=kotlin.Function0 GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null CALL 'public final fun run1 (r: .KRunnable): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: TYPE_OP type=kotlin.Function0 origin=IMPLICIT_CAST typeOperand=kotlin.Function0 - GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null + r: TYPE_OP type=.KRunnable origin=SAM_CONVERSION typeOperand=.KRunnable + TYPE_OP type=kotlin.Function0 origin=IMPLICIT_CAST typeOperand=kotlin.Function0 + GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null FUN name:test8 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY CALL 'public final fun run1 (r: .KRunnable): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: CALL 'public final fun id (x: T of .id): T of .id declared in ' type=kotlin.Function0 origin=null - : kotlin.Function0 - x: GET_VAR 'a: kotlin.Function0 declared in .test8' type=kotlin.Function0 origin=null + r: TYPE_OP type=.KRunnable origin=SAM_CONVERSION typeOperand=.KRunnable + CALL 'public final fun id (x: T of .id): T of .id declared in ' 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 final fun run1 (r: .KRunnable): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: FUNCTION_REFERENCE 'public final fun test9 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + r: TYPE_OP type=.KRunnable origin=SAM_CONVERSION typeOperand=.KRunnable + FUNCTION_REFERENCE 'public final fun test9 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt index 961a18a0013..244b909b2f8 100644 --- a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt @@ -12,11 +12,12 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null - r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null @@ -24,7 +25,8 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null - r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null @@ -36,7 +38,8 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null - r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null @@ -55,11 +58,12 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null VAR name:i2 type:.Test [val] CONSTRUCTOR_CALL 'public constructor (r: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null - r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null @@ -79,36 +83,40 @@ FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt VAR name:i4 type:.Test [val] CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? CONST String type=kotlin.String value="" VAR name:i5 type:.Test [val] CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null - r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r1: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null VAR name:i6 type:.Test [val] CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null - r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? SPREAD_ELEMENT GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt index 3cbbf9c377e..9993dde4ead 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt @@ -13,17 +13,19 @@ FILE fqName: fileName:/genericSamProjectedOut.kt GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit CALL 'public open fun plus (hello: example.Hello?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS $this: GET_VAR 'a: example.SomeJavaClass declared in .test' type=example.SomeJavaClass origin=null - hello: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit - VALUE_PARAMETER name:it index:0 type:kotlin.String? - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + hello: TYPE_OP type=example.Hello? origin=SAM_CONVERSION typeOperand=example.Hello? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit CALL 'public open fun get (hello: example.Hello?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null $this: GET_VAR 'a: example.SomeJavaClass declared in .test' type=example.SomeJavaClass origin=null - hello: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit - VALUE_PARAMETER name:it index:0 type:kotlin.String? - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + hello: TYPE_OP type=example.Hello? origin=SAM_CONVERSION typeOperand=example.Hello? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.txt index ca631aa280b..fdeaf4cd142 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall.fir.txt @@ -5,7 +5,8 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall.kt RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function1): .C declared in ' CONSTRUCTOR_CALL 'public constructor (jxx: .J.C?, X of .C?>?) declared in .C' type=.C origin=null : kotlin.String? - jxx: GET_VAR 'f: kotlin.Function1 declared in .test1' type=kotlin.Function1 origin=null + jxx: TYPE_OP type=.J.C?, X of .C?>? origin=SAM_CONVERSION typeOperand=.J.C?, X of .C?>? + GET_VAR 'f: kotlin.Function1 declared in .test1' type=kotlin.Function1 origin=null FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY @@ -13,5 +14,6 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall.kt GET_VAR 'x: kotlin.Any declared in .test2' type=kotlin.Any origin=null CONSTRUCTOR_CALL 'public constructor (jxx: .J.C?, X of .C?>?) declared in .C' type=.C origin=null : kotlin.String? - jxx: TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 - GET_VAR 'x: kotlin.Any declared in .test2' type=kotlin.Any origin=null + jxx: TYPE_OP type=.J.C?, X of .C?>? origin=SAM_CONVERSION typeOperand=.J.C?, X of .C?>? + TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 + GET_VAR 'x: kotlin.Any declared in .test2' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.txt index d808da166c7..451119049c6 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionInGenericConstructorCall_NI.fir.txt @@ -8,8 +8,10 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall_NI.kt : kotlin.Int? $outer: CONSTRUCTOR_CALL 'public constructor (jxx: .J.C?, X of .C?>?) declared in .C' type=.C origin=null : kotlin.String? - jxx: GET_VAR 'f1: kotlin.Function1 declared in .test3' type=kotlin.Function1 origin=null - jxy: GET_VAR 'f2: kotlin.Function1 declared in .test3' type=kotlin.Function1 origin=null + jxx: TYPE_OP type=.J.C?, X of .C?>? origin=SAM_CONVERSION typeOperand=.J.C?, X of .C?>? + GET_VAR 'f1: kotlin.Function1 declared in .test3' type=kotlin.Function1 origin=null + jxy: TYPE_OP type=.J.C.D?>? origin=SAM_CONVERSION typeOperand=.J.C.D?>? + GET_VAR 'f2: kotlin.Function1 declared in .test3' type=kotlin.Function1 origin=null CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer.Outer> TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?] @@ -84,8 +86,10 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall_NI.kt : kotlin.Any? $outer: CONSTRUCTOR_CALL 'public constructor (j11: .J.Outer, T1 of .Outer>) [primary] declared in .Outer' type=.Outer origin=null : kotlin.String? - j11: GET_VAR 'f: kotlin.Function1 declared in .test4' type=kotlin.Function1 origin=null - j12: GET_VAR 'g: kotlin.Function1 declared in .test4' type=kotlin.Function1 origin=null + j11: TYPE_OP type=.J.Outer, T1 of .Outer> origin=SAM_CONVERSION typeOperand=.J.Outer, T1 of .Outer> + GET_VAR 'f: kotlin.Function1 declared in .test4' type=kotlin.Function1 origin=null + j12: TYPE_OP type=.J.Outer.Inner> origin=SAM_CONVERSION typeOperand=.J.Outer.Inner> + GET_VAR 'g: kotlin.Function1 declared in .test4' type=kotlin.Function1 origin=null FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1) returnType:.G VALUE_PARAMETER name:f index:0 type:kotlin.Function1 BLOCK_BODY @@ -93,7 +97,8 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall_NI.kt CONSTRUCTOR_CALL 'public constructor (x: .J.G.?, TClass of .G?>?) declared in .G' type=.G origin=null : kotlin.String? : kotlin.Int? - x: GET_VAR 'f: kotlin.Function1 declared in .testGenericJavaCtor1' type=kotlin.Function1 origin=null + x: TYPE_OP type=.J.G.?, TClass of .G?>? origin=SAM_CONVERSION typeOperand=.J.G.?, TClass of .G?>? + GET_VAR 'f: kotlin.Function1 declared in .testGenericJavaCtor1' type=kotlin.Function1 origin=null FUN name:testGenericJavaCtor2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY @@ -102,5 +107,6 @@ FILE fqName: fileName:/samConversionInGenericConstructorCall_NI.kt CONSTRUCTOR_CALL 'public constructor (x: .J.G.?, TClass of .G?>?) declared in .G' type=.G origin=null : kotlin.String? : kotlin.Int? - x: TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 - GET_VAR 'x: kotlin.Any declared in .testGenericJavaCtor2' type=kotlin.Any origin=null + x: TYPE_OP type=.J.G.?, TClass of .G?>? origin=SAM_CONVERSION typeOperand=.J.G.?, TClass of .G?>? + TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 + GET_VAR 'x: kotlin.Any declared in .testGenericJavaCtor2' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt index 97cce9f79d7..062baf3e611 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt @@ -49,15 +49,17 @@ FILE fqName: fileName:/samConversionToGeneric.kt GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null CALL 'public open fun bar (j: .J.H.bar?>?): kotlin.Unit declared in .H' type=kotlin.Unit origin=null : kotlin.String? - j: TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 - GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null + j: TYPE_OP type=.J.H.bar?>? origin=SAM_CONVERSION typeOperand=.J.H.bar?>? + TYPE_OP type=kotlin.Function1 origin=IMPLICIT_CAST typeOperand=kotlin.Function1 + GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null FUN name:test6 visibility:public modality:FINAL (a:kotlin.Function1.test6, T of .test6>) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] VALUE_PARAMETER name:a index:0 type:kotlin.Function1.test6, T of .test6> BLOCK_BODY CALL 'public open fun bar (j: .J.H.bar?>?): kotlin.Unit declared in .H' type=kotlin.Unit origin=null : T of .test6? - j: GET_VAR 'a: kotlin.Function1.test6, T of .test6> declared in .test6' type=kotlin.Function1.test6, T of .test6> origin=null + j: TYPE_OP type=.J.H.bar?>? origin=SAM_CONVERSION typeOperand=.J.H.bar?>? + GET_VAR 'a: kotlin.Function1.test6, T of .test6> declared in .test6' type=kotlin.Function1.test6, T of .test6> origin=null FUN name:test7 visibility:public modality:FINAL (a:kotlin.Any) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] VALUE_PARAMETER name:a index:0 type:kotlin.Any @@ -66,8 +68,9 @@ FILE fqName: fileName:/samConversionToGeneric.kt GET_VAR 'a: kotlin.Any declared in .test7' type=kotlin.Any origin=null CALL 'public open fun bar (j: .J.H.bar?>?): kotlin.Unit declared in .H' type=kotlin.Unit origin=null : T of .test7? - j: TYPE_OP type=kotlin.Function1.test7, T of .test7> origin=IMPLICIT_CAST typeOperand=kotlin.Function1.test7, T of .test7> - GET_VAR 'a: kotlin.Any declared in .test7' type=kotlin.Any origin=null + j: TYPE_OP type=.J.H.bar?>? origin=SAM_CONVERSION typeOperand=.J.H.bar?>? + TYPE_OP type=kotlin.Function1.test7, T of .test7> origin=IMPLICIT_CAST typeOperand=kotlin.Function1.test7, T of .test7> + GET_VAR 'a: kotlin.Any declared in .test7' type=kotlin.Any origin=null FUN name:test8 visibility:public modality:FINAL <> (efn:kotlin.Function1) returnType:.J VALUE_PARAMETER name:efn index:0 type:kotlin.Function1 BLOCK_BODY @@ -80,7 +83,8 @@ FILE fqName: fileName:/samConversionToGeneric.kt BLOCK_BODY CALL 'public open fun bar (j: .J.H.bar?>?): kotlin.Unit declared in .H' type=kotlin.Unit origin=null : kotlin.String? - j: GET_VAR 'efn: kotlin.Function1 declared in .test9' type=kotlin.Function1 origin=null + j: TYPE_OP type=.J.H.bar?>? origin=SAM_CONVERSION typeOperand=.J.H.bar?>? + GET_VAR 'efn: kotlin.Function1 declared in .test9' type=kotlin.Function1 origin=null FUN name:test10 visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Unit VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.fir.txt deleted file mode 100644 index 7f5e1e5c824..00000000000 --- a/compiler/testData/ir/irText/expressions/sam/samConversions.fir.txt +++ /dev/null @@ -1,51 +0,0 @@ -FILE fqName: fileName:/samConversions.kt - FUN name:test0 visibility:public modality:FINAL <> ($receiver:.J, a:java.lang.Runnable) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:.J - VALUE_PARAMETER name:a index:0 type:java.lang.Runnable - BLOCK_BODY - CALL 'public open fun runStatic (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - r: GET_VAR 'a: java.lang.Runnable declared in .test0' type=java.lang.Runnable origin=null - CALL 'public open fun runIt (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - $this: GET_VAR ': .J declared in .test0' type=.J origin=null - r: GET_VAR 'a: java.lang.Runnable declared in .test0' type=java.lang.Runnable origin=null - FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - CALL 'public open fun runStatic (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - CALL 'public final fun test1 (): kotlin.Unit declared in ' type=kotlin.Unit origin=null - FUN name:test2 visibility:public modality:FINAL <> ($receiver:.J) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:.J - BLOCK_BODY - CALL 'public open fun runIt (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - $this: GET_VAR ': .J declared in .test2' type=.J origin=null - r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - CALL 'public final fun test1 (): kotlin.Unit declared in ' type=kotlin.Unit origin=null - FUN name:test3 visibility:public modality:FINAL <> ($receiver:.J, a:kotlin.Function0) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:.J - VALUE_PARAMETER name:a index:0 type:kotlin.Function0 - BLOCK_BODY - CALL 'public open fun run2 (r1: java.lang.Runnable?, r2: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - $this: GET_VAR ': .J declared in .test3' type=.J origin=null - r1: GET_VAR 'a: kotlin.Function0 declared in .test3' type=kotlin.Function0 origin=null - r2: GET_VAR 'a: kotlin.Function0 declared in .test3' type=kotlin.Function0 origin=null - FUN name:test4 visibility:public modality:FINAL <> ($receiver:.J, a:kotlin.Function0, b:kotlin.Function0, flag:kotlin.Boolean) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:.J - VALUE_PARAMETER name:a index:0 type:kotlin.Function0 - VALUE_PARAMETER name:b index:1 type:kotlin.Function0 - VALUE_PARAMETER name:flag index:2 type:kotlin.Boolean - BLOCK_BODY - CALL 'public open fun runIt (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - $this: GET_VAR ': .J declared in .test4' type=.J origin=null - r: WHEN type=kotlin.Function0 origin=IF - BRANCH - if: GET_VAR 'flag: kotlin.Boolean declared in .test4' type=kotlin.Boolean origin=null - then: GET_VAR 'a: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'b: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.kt b/compiler/testData/ir/irText/expressions/sam/samConversions.kt index c8420db8188..e9272601009 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversions.kt +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // WITH_JDK // FILE: samConversions.kt fun J.test0(a: Runnable) { diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt index 34f704c1b25..f32a585d296 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt @@ -45,7 +45,8 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt $this: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .J' type=.J origin=null r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null - r2: GET_VAR 'b: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'b: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY @@ -79,8 +80,9 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null 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=kotlin.Function0 origin=IMPLICIT_CAST typeOperand=kotlin.Function0 - GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + TYPE_OP type=kotlin.Function0 origin=IMPLICIT_CAST typeOperand=kotlin.Function0 + GET_VAR 'a: kotlin.Any declared in .test6' type=kotlin.Any origin=null FUN name:test7 visibility:public modality:FINAL <> (a:kotlin.Function1) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function1 BLOCK_BODY @@ -100,4 +102,5 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt BLOCK_BODY 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: FUNCTION_REFERENCE 'public final fun test9 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun test9 (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= diff --git a/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt index 337e8f7be6c..b0fc851b478 100644 --- a/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt @@ -6,29 +6,39 @@ FILE fqName: fileName:/samOperators.kt BLOCK_BODY CALL 'public open fun get (k: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test1' type=.J origin=null - k: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + k: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= CALL 'public open fun get (k: java.lang.Runnable?, m: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test1' type=.J origin=null - k: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - m: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + k: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + m: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= FUN name:test2 visibility:public modality:FINAL <> ($receiver:.J) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.J BLOCK_BODY CALL 'public open fun set (k: java.lang.Runnable?, v: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test2' type=.J origin=null - k: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - v: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + k: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + v: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= CALL 'public open fun set (k: java.lang.Runnable?, m: java.lang.Runnable?, v: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test2' type=.J origin=null - k: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - m: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - v: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + k: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + m: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + v: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= FUN name:test3 visibility:public modality:FINAL <> ($receiver:.J) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.J BLOCK_BODY CALL 'public open fun plusAssign (i: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test3' type=.J origin=null - i: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + i: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= CALL 'public open fun minusAssign (i: java.lang.Runnable?): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test3' type=.J origin=null - i: FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= + i: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget=