From 21fef703670d0378687ebc0268d91b2443f48825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Tue, 4 Oct 2022 15:19:30 +0200 Subject: [PATCH] Standardize context receiver parameter names Previously, FIR used `_context_receiver_n` while FE10 used `` for all context receiver parameters. This commit changes the code in FE10 to follow the convention from FIR. --- .../fir/backend/Fir2IrDeclarationStorage.kt | 2 +- .../kotlin/resolve/DescriptorResolver.java | 27 +-- .../resolve/FunctionDescriptorResolver.kt | 3 +- .../arrayAccessCompositeOperators.ir.txt | 34 +-- .../arrayAccessCompositeOperators.kt.txt | 18 +- .../arrayAccessOperators.ir.txt | 24 +-- .../arrayAccessOperators.kt.txt | 12 +- .../declarations/contextReceivers/class.txt | 79 ------- .../compoundAssignmentOperators.ir.txt | 88 ++++---- .../compoundAssignmentOperators.kt.txt | 40 ++-- .../contextualInlineCall.ir.txt | 72 +++---- .../contextualInlineCall.kt.txt | 34 +-- .../delegatedPropertiesOperators.ir.txt | 22 +- .../delegatedPropertiesOperators.kt.txt | 12 +- .../contextReceivers/fromKEEP/canvas.ir.txt | 18 +- .../contextReceivers/fromKEEP/canvas.kt.txt | 8 +- .../contextReceivers/fromKEEP/canvas.txt | 117 ----------- .../fromKEEP/compareTo.ir.txt | 22 +- .../fromKEEP/compareTo.kt.txt | 10 +- .../contextReceivers/fromKEEP/dp.ir.txt | 12 +- .../contextReceivers/fromKEEP/dp.kt.txt | 6 +- .../contextReceivers/fromKEEP/dp.txt | 83 -------- .../fromKEEP/functionalType.ir.txt | 18 +- .../fromKEEP/functionalType.kt.txt | 6 +- .../fromKEEP/functionalType.txt | 121 ----------- .../fromKEEP/monoidSum.ir.txt | 18 +- .../fromKEEP/monoidSum.kt.txt | 10 +- .../contextReceivers/fromKEEP/monoidSum.txt | 198 ------------------ .../contextReceivers/function.fir.ir.txt | 51 ----- .../contextReceivers/function.fir.kt.txt | 23 -- .../contextReceivers/function.ir.txt | 10 +- .../declarations/contextReceivers/function.kt | 1 + .../contextReceivers/function.kt.txt | 6 +- .../contextReceivers/function.txt | 50 ----- .../contextReceivers/functionalType.ir.txt | 96 ++++----- .../contextReceivers/functionalType.kt.txt | 48 ++--- .../contextReceivers/iteratorOperator.ir.txt | 12 +- .../contextReceivers/iteratorOperator.kt.txt | 6 +- .../declarations/contextReceivers/lazy.ir.txt | 54 ++--- .../declarations/contextReceivers/lazy.kt.txt | 24 +-- .../overloadPriority.fir.ir.txt | 45 ---- .../overloadPriority.fir.kt.txt | 23 -- .../contextReceivers/overloadPriority.ir.txt | 10 +- .../contextReceivers/overloadPriority.kt | 1 + .../contextReceivers/overloadPriority.kt.txt | 4 +- .../contextReceivers/overloading.fir.ir.txt | 32 --- .../contextReceivers/overloading.fir.kt.txt | 14 -- .../contextReceivers/overloading.ir.txt | 22 +- .../contextReceivers/overloading.kt | 1 + .../contextReceivers/overloading.kt.txt | 10 +- .../passingLambdaToContextualParam.ir.txt | 8 +- .../passingLambdaToContextualParam.kt.txt | 4 +- .../contextReceivers/plusMatrix.fir.ir.txt | 62 ------ .../contextReceivers/plusMatrix.fir.kt.txt | 22 -- .../contextReceivers/plusMatrix.ir.txt | 14 +- .../contextReceivers/plusMatrix.kt | 1 + .../contextReceivers/plusMatrix.kt.txt | 6 +- .../contextReceivers/property.fir.ir.txt | 48 ----- .../contextReceivers/property.fir.kt.txt | 14 -- .../contextReceivers/property.ir.txt | 12 +- .../declarations/contextReceivers/property.kt | 1 + .../contextReceivers/property.kt.txt | 5 +- .../thisWithCustomLabel.fir.ir.txt | 143 ------------- .../thisWithCustomLabel.fir.kt.txt | 55 ----- .../thisWithCustomLabel.ir.txt | 30 +-- .../contextReceivers/thisWithCustomLabel.kt | 1 + .../thisWithCustomLabel.kt.txt | 16 +- .../typeParameterAsContextReceiver.fir.ir.txt | 27 --- .../typeParameterAsContextReceiver.fir.kt.txt | 12 -- .../typeParameterAsContextReceiver.ir.txt | 8 +- .../typeParameterAsContextReceiver.kt | 1 + .../typeParameterAsContextReceiver.kt.txt | 4 +- .../contextReceivers/unaryOperators.ir.txt | 52 ++--- .../contextReceivers/unaryOperators.kt.txt | 26 +-- .../org/jetbrains/kotlin/name/NameUtils.kt | 4 + .../AbstractReceiverParameterDescriptor.java | 5 + .../impl/FunctionDescriptorImpl.java | 4 +- .../impl/ReceiverParameterDescriptorImpl.java | 13 +- .../kotlin/resolve/DescriptorFactory.java | 7 +- .../deserialization/MemberDeserializer.kt | 10 +- 80 files changed, 544 insertions(+), 1728 deletions(-) delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/class.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/function.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/function.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/function.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/property.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/property.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.kt.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 3f589eddf06..34568f130b1 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -1157,7 +1157,7 @@ class Fir2IrDeclarationStorage( return contextReceiver.convertWithOffsets { startOffset, endOffset -> irFactory.createValueParameter( startOffset, endOffset, IrDeclarationOrigin.DEFINED, IrValueParameterSymbolImpl(), - Name.identifier("_context_receiver_$index"), index, type, + NameUtils.contextReceiverName(index), index, type, null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index c2e341f274e..365d875f311 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -44,11 +44,11 @@ import org.jetbrains.kotlin.lexer.KtTokens; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt; -import org.jetbrains.kotlin.resolve.calls.util.CallResolverUtilKt; import org.jetbrains.kotlin.resolve.calls.components.InferenceSession; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory; +import org.jetbrains.kotlin.resolve.calls.util.CallResolverUtilKt; import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt; import org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension; import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; @@ -68,6 +68,7 @@ import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.IntStream; import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*; import static org.jetbrains.kotlin.diagnostics.Errors.*; @@ -975,18 +976,18 @@ public class DescriptorResolver { } List contextReceivers = variableDeclaration.getContextReceivers(); - List contextReceiverDescriptors = contextReceivers.stream() - .map(contextReceiver -> { - KtTypeReference typeReference = contextReceiver.typeReference(); - if (typeReference == null) { - return null; - } - KotlinType type = typeResolver.resolveType(scopeForDeclarationResolutionWithTypeParameters, typeReference, trace, true); - AnnotationSplitter splitter = new AnnotationSplitter(storageManager, type.getAnnotations(), EnumSet.of(RECEIVER)); - return DescriptorFactory.createContextReceiverParameterForCallable( - propertyDescriptor, type, contextReceiver.labelNameAsName(), splitter.getAnnotationsForTarget(RECEIVER) - ); - }).collect(Collectors.toList()); + List contextReceiverDescriptors = IntStream.range(0, contextReceivers.size()).mapToObj(index -> { + KtContextReceiver contextReceiver = contextReceivers.get(index); + KtTypeReference typeReference = contextReceiver.typeReference(); + if (typeReference == null) { + return null; + } + KotlinType type = typeResolver.resolveType(scopeForDeclarationResolutionWithTypeParameters, typeReference, trace, true); + AnnotationSplitter splitter = new AnnotationSplitter(storageManager, type.getAnnotations(), EnumSet.of(RECEIVER)); + return DescriptorFactory.createContextReceiverParameterForCallable( + propertyDescriptor, type, contextReceiver.labelNameAsName(), splitter.getAnnotationsForTarget(RECEIVER), index + ); + }).collect(Collectors.toList()); if (languageVersionSettings.supportsFeature(LanguageFeature.ContextReceivers)) { Multimap nameToReceiverMap = HashMultimap.create(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index 8e435c65b56..1a43ce515f0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -240,13 +240,14 @@ class FunctionDescriptorResolver( functionDescriptor, it, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER) ) } - val contextReceiverDescriptors = contextReceiverTypes.mapNotNull { contextReceiver -> + val contextReceiverDescriptors = contextReceiverTypes.mapIndexedNotNull { index, contextReceiver -> val splitter = AnnotationSplitter(storageManager, contextReceiver.type.annotations, EnumSet.of(AnnotationUseSiteTarget.RECEIVER)) DescriptorFactory.createContextReceiverParameterForCallable( functionDescriptor, contextReceiver.type, contextReceiver.label, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER), + index ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.ir.txt index 6bebca16ad1..8301115f022 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.ir.txt @@ -111,18 +111,18 @@ FILE fqName: fileName:/arrayAccessCompositeOperators.kt BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null - FUN name:get visibility:public modality:FINAL <> ($receiver:.MyContainer, :kotlin.Int, index:kotlin.Int) returnType:kotlin.Int [operator] + FUN name:get visibility:public modality:FINAL <> ($receiver:.MyContainer, _context_receiver_0:kotlin.Int, index:kotlin.Int) returnType:kotlin.Int [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.MyContainer - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:index index:1 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .get' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun get (: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .get' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun get (_context_receiver_0: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in ' WHEN type=kotlin.Int origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ @@ -133,17 +133,17 @@ FILE fqName: fileName:/arrayAccessCompositeOperators.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Int type=kotlin.Int value=-1 - FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:.MyContainer, :kotlin.Int, other:.MyContainer) returnType:kotlin.Unit [operator] + FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:.MyContainer, _context_receiver_0:kotlin.Int, other:.MyContainer) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.MyContainer - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.MyContainer BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .plusAssign' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .plusAssign' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=PLUSEQ VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.MyContainer [val] GET_VAR ': .MyContainer declared in .plusAssign' type=.MyContainer origin=null @@ -154,17 +154,17 @@ FILE fqName: fileName:/arrayAccessCompositeOperators.kt $this: GET_VAR 'val tmp_1: .MyContainer [val] declared in .plusAssign' type=.MyContainer origin=null other: CALL 'public final fun (): kotlin.Int declared in .MyContainer' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .MyContainer declared in .plusAssign' type=.MyContainer origin=null - FUN name:inc visibility:public modality:FINAL <> ($receiver:.MyContainer, :kotlin.Int) returnType:.MyContainer [operator] + FUN name:inc visibility:public modality:FINAL <> ($receiver:.MyContainer, _context_receiver_0:kotlin.Int) returnType:.MyContainer [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.MyContainer - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .inc' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun inc (: kotlin.Int): .MyContainer [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .inc' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun inc (_context_receiver_0: kotlin.Int): .MyContainer [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .MyContainer' type=.MyContainer origin=null i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun (): kotlin.Int declared in .MyContainer' type=kotlin.Int origin=GET_PROPERTY @@ -183,20 +183,20 @@ FILE fqName: fileName:/arrayAccessCompositeOperators.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int BLOCK_BODY - CALL 'public final fun plusAssign (: kotlin.Int, other: .MyContainer): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=PLUSEQ + CALL 'public final fun plusAssign (_context_receiver_0: kotlin.Int, other: .MyContainer): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=PLUSEQ $receiver: GET_VAR 'var myContainer: .MyContainer [var] declared in .box' type=.MyContainer origin=PLUSEQ - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null other: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .MyContainer' type=.MyContainer origin=null - i: CALL 'public final fun get (: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in ' type=kotlin.Int origin=GET_ARRAY_ELEMENT + i: CALL 'public final fun get (_context_receiver_0: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in ' type=kotlin.Int origin=GET_ARRAY_ELEMENT $receiver: BLOCK type=.MyContainer origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.MyContainer [val] GET_VAR 'var myContainer: .MyContainer [var] declared in .box' type=.MyContainer origin=POSTFIX_INCR SET_VAR 'var myContainer: .MyContainer [var] declared in .box' type=kotlin.Unit origin=POSTFIX_INCR - CALL 'public final fun inc (: kotlin.Int): .MyContainer [operator] declared in ' type=.MyContainer origin=POSTFIX_INCR + CALL 'public final fun inc (_context_receiver_0: kotlin.Int): .MyContainer [operator] declared in ' type=.MyContainer origin=POSTFIX_INCR $receiver: GET_VAR 'val tmp_2: .MyContainer [val] declared in .box.' type=.MyContainer origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null GET_VAR 'val tmp_2: .MyContainer [val] declared in .box.' type=.MyContainer origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null index: CONST Int type=kotlin.Int value=0 RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' WHEN type=kotlin.String origin=IF diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.kt.txt index 744f010d431..dc00457268d 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessCompositeOperators.kt.txt @@ -47,9 +47,9 @@ var operationScore: Int get set -operator fun MyContainer.get(: Int, index: Int): Int { +operator fun MyContainer.get(_context_receiver_0: Int, index: Int): Int { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return when { EQEQ(arg0 = index, arg1 = 0) -> .() @@ -57,9 +57,9 @@ operator fun MyContainer.get(: Int, index: Int): Int { } } -operator fun MyContainer.plusAssign(: Int, other: MyContainer) { +operator fun MyContainer.plusAssign(_context_receiver_0: Int, other: MyContainer) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } { // BLOCK val tmp0_this: MyContainer = @@ -67,9 +67,9 @@ operator fun MyContainer.plusAssign(: Int, other: MyContainer) { } } -operator fun MyContainer.inc(: Int): MyContainer { +operator fun MyContainer.inc(_context_receiver_0: Int): MyContainer { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return MyContainer(i = .().plus(other = 1)) } @@ -77,11 +77,11 @@ operator fun MyContainer.inc(: Int): MyContainer { fun box(): String { var myContainer: MyContainer = MyContainer(i = 0) with(receiver = 1, block = local fun Int.() { - myContainer.plusAssign( = $this$with, other = MyContainer(i = { // BLOCK + myContainer.plusAssign(_context_receiver_0 = $this$with, other = MyContainer(i = { // BLOCK val tmp0: MyContainer = myContainer - myContainer = tmp0.inc( = $this$with) + myContainer = tmp0.inc(_context_receiver_0 = $this$with) tmp0 - }.get( = $this$with, index = 0))) + }.get(_context_receiver_0 = $this$with, index = 0))) } ) return when { diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.ir.txt index 12c4dbdf533..aef1d236895 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.ir.txt @@ -96,13 +96,13 @@ FILE fqName: fileName:/arrayAccessOperators.kt CONST Boolean type=kotlin.Boolean value=false RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .MyContainer' CONST Boolean type=kotlin.Boolean value=true - FUN name:get visibility:public modality:FINAL <> ($receiver:.MyContainer, :kotlin.Int, index:kotlin.Int) returnType:kotlin.String? [operator] + FUN name:get visibility:public modality:FINAL <> ($receiver:.MyContainer, _context_receiver_0:kotlin.Int, index:kotlin.Int) returnType:kotlin.String? [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.MyContainer - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:index index:1 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun get (: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in ' + RETURN type=kotlin.Nothing from='public final fun get (_context_receiver_0: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in ' WHEN type=kotlin.String? origin=IF BRANCH if: WHEN type=kotlin.Boolean origin=ANDAND @@ -111,7 +111,7 @@ FILE fqName: fileName:/arrayAccessOperators.kt arg0: GET_VAR 'index: kotlin.Int declared in .get' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR ': kotlin.Int declared in .get' type=kotlin.Int origin=null + arg0: GET_VAR '_context_receiver_0: kotlin.Int declared in .get' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -121,10 +121,10 @@ FILE fqName: fileName:/arrayAccessOperators.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Null type=kotlin.Nothing? value=null - FUN name:set visibility:public modality:FINAL <> ($receiver:.MyContainer, :kotlin.Int, index:kotlin.Int, value:kotlin.String) returnType:kotlin.Unit [operator] + FUN name:set visibility:public modality:FINAL <> ($receiver:.MyContainer, _context_receiver_0:kotlin.Int, index:kotlin.Int, value:kotlin.String) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.MyContainer - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:index index:1 type:kotlin.Int VALUE_PARAMETER name:value index:2 type:kotlin.String BLOCK_BODY @@ -141,9 +141,9 @@ FILE fqName: fileName:/arrayAccessOperators.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - arg0: GET_VAR ': kotlin.Int declared in .set' type=kotlin.Int origin=null + arg0: GET_VAR '_context_receiver_0: kotlin.Int declared in .set' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=42 - then: RETURN type=kotlin.Nothing from='public final fun set (: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in ' + then: RETURN type=kotlin.Nothing from='public final fun set (_context_receiver_0: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in ' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit CALL 'public final fun (: kotlin.String): kotlin.Unit declared in .MyContainer' type=kotlin.Unit origin=EQ $this: GET_VAR ': .MyContainer declared in .set' type=.MyContainer origin=null @@ -162,17 +162,17 @@ FILE fqName: fileName:/arrayAccessOperators.kt VAR name:myContainer type:.MyContainer [val] CONSTRUCTOR_CALL 'public constructor (s: kotlin.String) [primary] declared in .MyContainer' type=.MyContainer origin=null s: CONST String type=kotlin.String value="fail" - CALL 'public final fun set (: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=EQ + CALL 'public final fun set (_context_receiver_0: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=EQ $receiver: GET_VAR 'val myContainer: .MyContainer [val] declared in .box.' type=.MyContainer origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null index: CONST Int type=kotlin.Int value=0 value: CONST String type=kotlin.String value="OK" RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' BLOCK type=kotlin.String origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.String? [val] - CALL 'public final fun get (: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in ' type=kotlin.String? origin=GET_ARRAY_ELEMENT + CALL 'public final fun get (_context_receiver_0: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in ' type=kotlin.String? origin=GET_ARRAY_ELEMENT $receiver: GET_VAR 'val myContainer: .MyContainer [val] declared in .box.' type=.MyContainer origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null index: CONST Int type=kotlin.Int value=0 WHEN type=kotlin.String origin=null BRANCH diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.kt.txt index bd746cf5a95..04940716722 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/arrayAccessOperators.kt.txt @@ -42,21 +42,21 @@ data class MyContainer { } -operator fun MyContainer.get(: Int, index: Int): String? { +operator fun MyContainer.get(_context_receiver_0: Int, index: Int): String? { return when { when { - EQEQ(arg0 = index, arg1 = 0) -> EQEQ(arg0 = , arg1 = 42) + EQEQ(arg0 = index, arg1 = 0) -> EQEQ(arg0 = _context_receiver_0, arg1 = 42) else -> false } -> .() else -> null } } -operator fun MyContainer.set(: Int, index: Int, value: String) { +operator fun MyContainer.set(_context_receiver_0: Int, index: Int, value: String) { when { when { EQEQ(arg0 = index, arg1 = 0).not() -> true - else -> EQEQ(arg0 = , arg1 = 42).not() + else -> EQEQ(arg0 = _context_receiver_0, arg1 = 42).not() } -> return Unit } .( = value) @@ -65,9 +65,9 @@ operator fun MyContainer.set(: Int, index: Int, value: String) { fun box(): String { return with(receiver = 42, block = local fun Int.(): String { val myContainer: MyContainer = MyContainer(s = "fail") - myContainer.set( = $this$with, index = 0, value = "OK") + myContainer.set(_context_receiver_0 = $this$with, index = 0, value = "OK") return { // BLOCK - val tmp0_elvis_lhs: String? = myContainer.get( = $this$with, index = 0) + val tmp0_elvis_lhs: String? = myContainer.get(_context_receiver_0 = $this$with, index = 0) when { EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> "fail" else -> tmp0_elvis_lhs diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/class.txt b/compiler/testData/ir/irText/declarations/contextReceivers/class.txt deleted file mode 100644 index ad2ea8af626..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/class.txt +++ /dev/null @@ -1,79 +0,0 @@ -FILE fqName: fileName:/class.kt - CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer - 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]' - PROPERTY name:x visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] - EXPRESSION_BODY - CONST Int type=kotlin.Int value=1 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Outer) returnType:kotlin.Int - correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Outer - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .Outer' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .Outer declared in .Outer.' type=.Outer origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:Inner modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Inner - FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.Outer visibility:private [final] - CONSTRUCTOR visibility:public <> (:.Outer, arg:kotlin.Any) returnType:.Inner [primary] - VALUE_PARAMETER name: index:0 type:.Outer - VALUE_PARAMETER name:arg index:1 type:kotlin.Any - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.Outer visibility:private [final]' type=kotlin.Unit origin=null - receiver: GET_VAR ': .Inner declared in .Inner' type=.Inner origin=null - value: GET_VAR ': .Outer declared in .Inner.' type=.Outer origin=null - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN name:bar visibility:public modality:FINAL <> ($this:.Inner) returnType:kotlin.Int - $this: VALUE_PARAMETER name: type:.Inner - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun bar (): kotlin.Int declared in .Inner' - CALL 'public final fun (): kotlin.Int declared in .Outer' type=kotlin.Int origin=GET_PROPERTY - $this: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.Outer visibility:private [final]' type=.Outer origin=null - receiver: GET_VAR ': .Inner declared in .Inner.bar' type=.Inner origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL <> (outer:.Outer) returnType:kotlin.Unit - VALUE_PARAMETER name:outer index:0 type:.Outer - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=.Inner origin=null - : .Outer - : .Inner - receiver: GET_VAR 'outer: .Outer declared in .f' type=.Outer origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.Outer, .Inner> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Outer) returnType:.Inner - $receiver: VALUE_PARAMETER name:$this$with type:.Outer - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): .Inner declared in .f' - CONSTRUCTOR_CALL 'public constructor (: .Outer, arg: kotlin.Any) [primary] declared in .Inner' type=.Inner origin=null - : GET_VAR '$this$with: .Outer declared in .f.' type=.Outer origin=null - arg: CONST Int type=kotlin.Int value=3 diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.ir.txt index 43a65e23f56..2cded937ab7 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.ir.txt @@ -111,35 +111,35 @@ FILE fqName: fileName:/compoundAssignmentOperators.kt BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null - FUN name:plus visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:.Result [operator] + FUN name:plus visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .plus' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun plus (: kotlin.Int, other: .Result): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .plus' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun plus (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .plus' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .plus' type=.Result origin=null - FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] + FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .plusAssign' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .plusAssign' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=PLUSEQ VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Result [val] GET_VAR ': .Result declared in .plusAssign' type=.Result origin=null @@ -150,35 +150,35 @@ FILE fqName: fileName:/compoundAssignmentOperators.kt $this: GET_VAR 'val tmp_1: .Result [val] declared in .plusAssign' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .plusAssign' type=.Result origin=null - FUN name:minus visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:.Result [operator] + FUN name:minus visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .minus' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun minus (: kotlin.Int, other: .Result): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .minus' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun minus (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .minus' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .minus' type=.Result origin=null - FUN name:minusAssign visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] + FUN name:minusAssign visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .minusAssign' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .minusAssign' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=MINUSEQ VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Result [val] GET_VAR ': .Result declared in .minusAssign' type=.Result origin=null @@ -189,35 +189,35 @@ FILE fqName: fileName:/compoundAssignmentOperators.kt $this: GET_VAR 'val tmp_2: .Result [val] declared in .minusAssign' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .minusAssign' type=.Result origin=null - FUN name:times visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:.Result [operator] + FUN name:times visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .times' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun times (: kotlin.Int, other: .Result): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .times' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun times (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .times' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .times' type=.Result origin=null - FUN name:timesAssign visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] + FUN name:timesAssign visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .timesAssign' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .timesAssign' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=MULTEQ VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:.Result [val] GET_VAR ': .Result declared in .timesAssign' type=.Result origin=null @@ -228,35 +228,35 @@ FILE fqName: fileName:/compoundAssignmentOperators.kt $this: GET_VAR 'val tmp_3: .Result [val] declared in .timesAssign' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .timesAssign' type=.Result origin=null - FUN name:div visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:.Result [operator] + FUN name:div visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .div' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun div (: kotlin.Int, other: .Result): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .div' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun div (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=DIV $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .div' type=.Result origin=null other: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'other: .Result declared in .div' type=.Result origin=null - FUN name:divAssign visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] + FUN name:divAssign visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int, other:.Result) returnType:kotlin.Unit [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:other index:1 type:.Result BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .divAssign' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .divAssign' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=DIVEQ VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:.Result [val] GET_VAR ': .Result declared in .divAssign' type=.Result origin=null @@ -280,40 +280,40 @@ FILE fqName: fileName:/compoundAssignmentOperators.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int BLOCK_BODY - CALL 'public final fun plusAssign (: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=PLUSEQ + CALL 'public final fun plusAssign (_context_receiver_0: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=PLUSEQ $receiver: GET_VAR 'val result: .Result [val] declared in .box' type=.Result origin=PLUSEQ - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null - other: CALL 'public final fun plus (: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=PLUS + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + other: CALL 'public final fun plus (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=PLUS $receiver: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null other: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=1 - CALL 'public final fun minusAssign (: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=MINUSEQ + CALL 'public final fun minusAssign (_context_receiver_0: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=MINUSEQ $receiver: GET_VAR 'val result: .Result [val] declared in .box' type=.Result origin=MINUSEQ - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null - other: CALL 'public final fun minus (: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=MINUS + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + other: CALL 'public final fun minus (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=MINUS $receiver: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null other: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=0 - CALL 'public final fun timesAssign (: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=MULTEQ + CALL 'public final fun timesAssign (_context_receiver_0: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=MULTEQ $receiver: GET_VAR 'val result: .Result [val] declared in .box' type=.Result origin=MULTEQ - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null - other: CALL 'public final fun times (: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=MUL + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + other: CALL 'public final fun times (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=MUL $receiver: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null other: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=2 - CALL 'public final fun divAssign (: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=DIVEQ + CALL 'public final fun divAssign (_context_receiver_0: kotlin.Int, other: .Result): kotlin.Unit [operator] declared in ' type=kotlin.Unit origin=DIVEQ $receiver: GET_VAR 'val result: .Result [val] declared in .box' type=.Result origin=DIVEQ - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null - other: CALL 'public final fun div (: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=DIV + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + other: CALL 'public final fun div (_context_receiver_0: kotlin.Int, other: .Result): .Result [operator] declared in ' type=.Result origin=DIV $receiver: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=4 - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null other: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CONST Int type=kotlin.Int value=2 RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.kt.txt index 258dadf07fb..e7f287e913a 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.kt.txt @@ -47,16 +47,16 @@ var operationScore: Int get set -operator fun Result.plus(: Int, other: Result): Result { +operator fun Result.plus(_context_receiver_0: Int, other: Result): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().plus(other = other.())) } -operator fun Result.plusAssign(: Int, other: Result) { +operator fun Result.plusAssign(_context_receiver_0: Int, other: Result) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } { // BLOCK val tmp0_this: Result = @@ -64,16 +64,16 @@ operator fun Result.plusAssign(: Int, other: Result) { } } -operator fun Result.minus(: Int, other: Result): Result { +operator fun Result.minus(_context_receiver_0: Int, other: Result): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().minus(other = other.())) } -operator fun Result.minusAssign(: Int, other: Result) { +operator fun Result.minusAssign(_context_receiver_0: Int, other: Result) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } { // BLOCK val tmp0_this: Result = @@ -81,16 +81,16 @@ operator fun Result.minusAssign(: Int, other: Result) { } } -operator fun Result.times(: Int, other: Result): Result { +operator fun Result.times(_context_receiver_0: Int, other: Result): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().times(other = other.())) } -operator fun Result.timesAssign(: Int, other: Result) { +operator fun Result.timesAssign(_context_receiver_0: Int, other: Result) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } { // BLOCK val tmp0_this: Result = @@ -98,16 +98,16 @@ operator fun Result.timesAssign(: Int, other: Result) { } } -operator fun Result.div(: Int, other: Result): Result { +operator fun Result.div(_context_receiver_0: Int, other: Result): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().div(other = other.())) } -operator fun Result.divAssign(: Int, other: Result) { +operator fun Result.divAssign(_context_receiver_0: Int, other: Result) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } { // BLOCK val tmp0_this: Result = @@ -118,10 +118,10 @@ operator fun Result.divAssign(: Int, other: Result) { fun box(): String { val result: Result = Result(i = 0) with(receiver = 1, block = local fun Int.() { - result.plusAssign( = $this$with, other = Result(i = 1).plus( = $this$with, other = Result(i = 1))) - result.minusAssign( = $this$with, other = Result(i = 1).minus( = $this$with, other = Result(i = 0))) - result.timesAssign( = $this$with, other = Result(i = 1).times( = $this$with, other = Result(i = 2))) - result.divAssign( = $this$with, other = Result(i = 4).div( = $this$with, other = Result(i = 2))) + result.plusAssign(_context_receiver_0 = $this$with, other = Result(i = 1).plus(_context_receiver_0 = $this$with, other = Result(i = 1))) + result.minusAssign(_context_receiver_0 = $this$with, other = Result(i = 1).minus(_context_receiver_0 = $this$with, other = Result(i = 0))) + result.timesAssign(_context_receiver_0 = $this$with, other = Result(i = 1).times(_context_receiver_0 = $this$with, other = Result(i = 2))) + result.divAssign(_context_receiver_0 = $this$with, other = Result(i = 4).div(_context_receiver_0 = $this$with, other = Result(i = 2))) } ) return when { diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.ir.txt index dd4610b2110..b793d728e04 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.ir.txt @@ -23,44 +23,44 @@ FILE fqName: fileName:/contextualInlineCall.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:testInline visibility:public modality:FINAL <> (:.Context) returnType:kotlin.Int [inline] + FUN name:testInline visibility:public modality:FINAL <> (_context_receiver_0:.Context) returnType:kotlin.Int [inline] contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testInline (: .Context): kotlin.Int [inline] declared in ' + RETURN type=kotlin.Nothing from='public final fun testInline (_context_receiver_0: .Context): kotlin.Int [inline] declared in ' CALL 'public final fun c (): kotlin.Int declared in .Context' type=kotlin.Int origin=null - $this: GET_VAR ': .Context declared in .testInline' type=.Context origin=null - FUN name:testInlineWithArg visibility:public modality:FINAL <> (:.Context, i:kotlin.Int) returnType:kotlin.Int [inline] + $this: GET_VAR '_context_receiver_0: .Context declared in .testInline' type=.Context origin=null + FUN name:testInlineWithArg visibility:public modality:FINAL <> (_context_receiver_0:.Context, i:kotlin.Int) returnType:kotlin.Int [inline] contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context VALUE_PARAMETER name:i index:1 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testInlineWithArg (: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' + RETURN type=kotlin.Nothing from='public final fun testInlineWithArg (_context_receiver_0: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: GET_VAR 'i: kotlin.Int declared in .testInlineWithArg' type=kotlin.Int origin=null other: CALL 'public final fun c (): kotlin.Int declared in .Context' type=kotlin.Int origin=null - $this: GET_VAR ': .Context declared in .testInlineWithArg' type=.Context origin=null - FUN name:testInlineWithExtensionAndArg visibility:public modality:FINAL <> ($receiver:kotlin.Int, :.Context, i:kotlin.Int) returnType:kotlin.Int [inline] + $this: GET_VAR '_context_receiver_0: .Context declared in .testInlineWithArg' type=.Context origin=null + FUN name:testInlineWithExtensionAndArg visibility:public modality:FINAL <> ($receiver:kotlin.Int, _context_receiver_0:.Context, i:kotlin.Int) returnType:kotlin.Int [inline] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name: index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context VALUE_PARAMETER name:i index:1 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndArg (: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' + RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndArg (_context_receiver_0: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: GET_VAR ': kotlin.Int declared in .testInlineWithExtensionAndArg' type=kotlin.Int origin=null other: GET_VAR 'i: kotlin.Int declared in .testInlineWithExtensionAndArg' type=kotlin.Int origin=null other: CALL 'public final fun c (): kotlin.Int declared in .Context' type=kotlin.Int origin=null - $this: GET_VAR ': .Context declared in .testInlineWithExtensionAndArg' type=.Context origin=null - FUN name:testInlineWithExtensionAndMultipleArgs visibility:public modality:FINAL <> ($receiver:kotlin.Int, :.Context, i1:kotlin.Int, i2:kotlin.Int) returnType:kotlin.Int [inline] + $this: GET_VAR '_context_receiver_0: .Context declared in .testInlineWithExtensionAndArg' type=.Context origin=null + FUN name:testInlineWithExtensionAndMultipleArgs visibility:public modality:FINAL <> ($receiver:kotlin.Int, _context_receiver_0:.Context, i1:kotlin.Int, i2:kotlin.Int) returnType:kotlin.Int [inline] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name: index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context VALUE_PARAMETER name:i1 index:1 type:kotlin.Int VALUE_PARAMETER name:i2 index:2 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndMultipleArgs (: .Context, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' + RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndMultipleArgs (_context_receiver_0: .Context, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS @@ -68,7 +68,7 @@ FILE fqName: fileName:/contextualInlineCall.kt other: GET_VAR 'i1: kotlin.Int declared in .testInlineWithExtensionAndMultipleArgs' type=kotlin.Int origin=null other: GET_VAR 'i2: kotlin.Int declared in .testInlineWithExtensionAndMultipleArgs' type=kotlin.Int origin=null other: CALL 'public final fun c (): kotlin.Int declared in .Context' type=kotlin.Int origin=null - $this: GET_VAR ': .Context declared in .testInlineWithExtensionAndMultipleArgs' type=.Context origin=null + $this: GET_VAR '_context_receiver_0: .Context declared in .testInlineWithExtensionAndMultipleArgs' type=.Context origin=null CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A CONSTRUCTOR visibility:public <> (a:kotlin.Any?) returnType:.A [primary] @@ -100,11 +100,11 @@ FILE fqName: fileName:/contextualInlineCall.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:testInlineWithExtensionAndMultipleContextsAndArgs visibility:public modality:FINAL <> ($receiver:kotlin.Int, :.Context, :.A, i1:kotlin.Int, i2:kotlin.Int) returnType:kotlin.Int [inline] + FUN name:testInlineWithExtensionAndMultipleContextsAndArgs visibility:public modality:FINAL <> ($receiver:kotlin.Int, _context_receiver_0:.Context, _context_receiver_1:.A, i1:kotlin.Int, i2:kotlin.Int) returnType:kotlin.Int [inline] contextReceiverParametersCount: 2 $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name: index:0 type:.Context - VALUE_PARAMETER name: index:1 type:.A + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_1 index:1 type:.A VALUE_PARAMETER name:i1 index:2 type:kotlin.Int EXPRESSION_BODY CONST Int type=kotlin.Int value=1 @@ -112,7 +112,7 @@ FILE fqName: fileName:/contextualInlineCall.kt EXPRESSION_BODY CONST Int type=kotlin.Int value=2 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndMultipleContextsAndArgs (: .Context, : .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' + RETURN type=kotlin.Nothing from='public final fun testInlineWithExtensionAndMultipleContextsAndArgs (_context_receiver_0: .Context, _context_receiver_1: .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS @@ -121,12 +121,12 @@ FILE fqName: fileName:/contextualInlineCall.kt other: GET_VAR 'i1: kotlin.Int declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=kotlin.Int origin=null other: GET_VAR 'i2: kotlin.Int declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=kotlin.Int origin=null other: CALL 'public final fun c (): kotlin.Int declared in .Context' type=kotlin.Int origin=null - $this: GET_VAR ': .Context declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=.Context origin=null + $this: GET_VAR '_context_receiver_0: .Context declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=.Context origin=null other: WHEN type=kotlin.Int origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: CALL 'public final fun (): kotlin.Any? declared in .A' type=kotlin.Any? origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=.A origin=null + $this: GET_VAR '_context_receiver_1: .A declared in .testInlineWithExtensionAndMultipleContextsAndArgs' type=.A origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH @@ -148,27 +148,27 @@ FILE fqName: fileName:/contextualInlineCall.kt SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInline (: .Context): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + other: CALL 'public final fun testInline (_context_receiver_0: .Context): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInlineWithArg (: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + other: CALL 'public final fun testInlineWithArg (_context_receiver_0: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null i: CONST Int type=kotlin.Int value=1 SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInlineWithExtensionAndArg (: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + other: CALL 'public final fun testInlineWithExtensionAndArg (_context_receiver_0: .Context, i: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null $receiver: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null i: CONST Int type=kotlin.Int value=1 SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInlineWithExtensionAndMultipleArgs (: .Context, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + other: CALL 'public final fun testInlineWithExtensionAndMultipleArgs (_context_receiver_0: .Context, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null $receiver: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null i1: CONST Int type=kotlin.Int value=1 i2: CONST Int type=kotlin.Int value=2 CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null @@ -183,19 +183,19 @@ FILE fqName: fileName:/contextualInlineCall.kt SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInlineWithExtensionAndMultipleContextsAndArgs (: .Context, : .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + other: CALL 'public final fun testInlineWithExtensionAndMultipleContextsAndArgs (_context_receiver_0: .Context, _context_receiver_1: .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null $receiver: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null - : GET_VAR '$this$with: .A declared in .box..' type=.A origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + _context_receiver_1: GET_VAR '$this$with: .A declared in .box..' type=.A origin=null i1: CONST Int type=kotlin.Int value=1 i2: CONST Int type=kotlin.Int value=2 SET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: GET_VAR 'var result: kotlin.Int [var] declared in .box.' type=kotlin.Int origin=PLUSEQ - other: CALL 'public final fun testInlineWithExtensionAndMultipleContextsAndArgs (: .Context, : .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null + other: CALL 'public final fun testInlineWithExtensionAndMultipleContextsAndArgs (_context_receiver_0: .Context, _context_receiver_1: .A, i1: kotlin.Int, i2: kotlin.Int): kotlin.Int [inline] declared in ' type=kotlin.Int origin=null $receiver: CONST Int type=kotlin.Int value=1 - : GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null - : GET_VAR '$this$with: .A declared in .box..' type=.A origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .box.' type=.Context origin=null + _context_receiver_1: GET_VAR '$this$with: .A declared in .box..' type=.A origin=null RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' WHEN type=kotlin.String origin=IF BRANCH diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.kt.txt index eb213ca462b..7eb5e64b6da 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/contextualInlineCall.kt.txt @@ -11,20 +11,20 @@ class Context { } -inline fun testInline(: Context): Int { - return .c() +inline fun testInline(_context_receiver_0: Context): Int { + return _context_receiver_0.c() } -inline fun testInlineWithArg(: Context, i: Int): Int { - return i.plus(other = .c()) +inline fun testInlineWithArg(_context_receiver_0: Context, i: Int): Int { + return i.plus(other = _context_receiver_0.c()) } -inline fun Int.testInlineWithExtensionAndArg(: Context, i: Int): Int { - return .plus(other = i).plus(other = .c()) +inline fun Int.testInlineWithExtensionAndArg(_context_receiver_0: Context, i: Int): Int { + return .plus(other = i).plus(other = _context_receiver_0.c()) } -inline fun Int.testInlineWithExtensionAndMultipleArgs(: Context, i1: Int, i2: Int): Int { - return .plus(other = i1).plus(other = i2).plus(other = .c()) +inline fun Int.testInlineWithExtensionAndMultipleArgs(_context_receiver_0: Context, i1: Int, i2: Int): Int { + return .plus(other = i1).plus(other = i2).plus(other = _context_receiver_0.c()) } class A { @@ -40,9 +40,9 @@ class A { } -inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(: Context, : A, i1: Int = 1, i2: Int = 2): Int { - return .plus(other = i1).plus(other = i2).plus(other = .c()).plus(other = when { - EQEQ(arg0 = .(), arg1 = null) -> 0 +inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(_context_receiver_0: Context, _context_receiver_1: A, i1: Int = 1, i2: Int = 2): Int { + return .plus(other = i1).plus(other = i2).plus(other = _context_receiver_0.c()).plus(other = when { + EQEQ(arg0 = _context_receiver_1.(), arg1 = null) -> 0 else -> 1 }) } @@ -50,13 +50,13 @@ inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(: Context fun box(): String { return with(receiver = Context(), block = local fun Context.(): Nothing { var result: Int = 0 - result = result.plus(other = testInline( = $this$with)) - result = result.plus(other = testInlineWithArg( = $this$with, i = 1)) - result = result.plus(other = 1.testInlineWithExtensionAndArg( = $this$with, i = 1)) - result = result.plus(other = 1.testInlineWithExtensionAndMultipleArgs( = $this$with, i1 = 1, i2 = 2)) + result = result.plus(other = testInline(_context_receiver_0 = $this$with)) + result = result.plus(other = testInlineWithArg(_context_receiver_0 = $this$with, i = 1)) + result = result.plus(other = 1.testInlineWithExtensionAndArg(_context_receiver_0 = $this$with, i = 1)) + result = result.plus(other = 1.testInlineWithExtensionAndMultipleArgs(_context_receiver_0 = $this$with, i1 = 1, i2 = 2)) with(receiver = A(a = 1), block = local fun A.() { - result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs( = $this$with, = $this$with, i1 = 1, i2 = 2)) - result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs( = $this$with, = $this$with)) + result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs(_context_receiver_0 = $this$with, _context_receiver_1 = $this$with, i1 = 1, i2 = 2)) + result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs(_context_receiver_0 = $this$with, _context_receiver_1 = $this$with)) } ) return when { diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.ir.txt index 6eb83431fe8..99ebce6f577 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.ir.txt @@ -39,10 +39,10 @@ FILE fqName: fileName:/delegatedPropertiesOperators.kt SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:delegateValue type:kotlin.String visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': .Delegate declared in .Delegate.' type=.Delegate origin=null value: GET_VAR ': kotlin.String declared in .Delegate.' type=kotlin.String origin=null - FUN name:getValue visibility:public modality:FINAL <> ($this:.Delegate, :kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:kotlin.String [operator] + FUN name:getValue visibility:public modality:FINAL <> ($this:.Delegate, _context_receiver_0:kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:kotlin.String [operator] $this: VALUE_PARAMETER name: type:.Delegate contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:thisRef index:1 type:kotlin.Any? VALUE_PARAMETER name:property index:2 type:kotlin.reflect.KProperty<*> BLOCK_BODY @@ -50,14 +50,14 @@ FILE fqName: fileName:/delegatedPropertiesOperators.kt CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .Delegate.getValue' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun getValue (: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in .Delegate' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .Delegate.getValue' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun getValue (_context_receiver_0: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in .Delegate' CALL 'public final fun (): kotlin.String declared in .Delegate' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR ': .Delegate declared in .Delegate.getValue' type=.Delegate origin=null - FUN name:setValue visibility:public modality:FINAL <> ($this:.Delegate, :kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>, value:kotlin.String) returnType:kotlin.Unit [operator] + FUN name:setValue visibility:public modality:FINAL <> ($this:.Delegate, _context_receiver_0:kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>, value:kotlin.String) returnType:kotlin.Unit [operator] $this: VALUE_PARAMETER name: type:.Delegate contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int VALUE_PARAMETER name:thisRef index:1 type:kotlin.Any? VALUE_PARAMETER name:property index:2 type:kotlin.reflect.KProperty<*> VALUE_PARAMETER name:value index:3 type:kotlin.String @@ -66,7 +66,7 @@ FILE fqName: fileName:/delegatedPropertiesOperators.kt CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .Delegate.setValue' type=kotlin.Int origin=null + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .Delegate.setValue' type=kotlin.Int origin=null CALL 'public final fun (: kotlin.String): kotlin.Unit declared in .Delegate' type=kotlin.Unit origin=EQ $this: GET_VAR ': .Delegate declared in .Delegate.setValue' type=.Delegate origin=null : GET_VAR 'value: kotlin.String declared in .Delegate.setValue' type=kotlin.String origin=null @@ -103,10 +103,10 @@ FILE fqName: fileName:/delegatedPropertiesOperators.kt $this: VALUE_PARAMETER name: type:.Result BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Result' - CALL 'public final fun getValue (: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in .Delegate' type=kotlin.String origin=null + CALL 'public final fun getValue (_context_receiver_0: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in .Delegate' type=kotlin.String origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:s$delegate type:.Delegate visibility:private [final]' type=.Delegate origin=null receiver: GET_VAR ': .Result declared in .Result.' type=.Result origin=null - : GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + _context_receiver_0: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null receiver: GET_VAR ': .Result declared in .Result.' type=.Result origin=null thisRef: GET_VAR ': .Result declared in .Result.' type=.Result origin=null property: PROPERTY_REFERENCE 'public final s: kotlin.String [delegated,var]' field=null getter='public final fun (): kotlin.String declared in .Result' setter='public final fun (: kotlin.String): kotlin.Unit declared in .Result' type=kotlin.reflect.KMutableProperty1<.Result, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -116,10 +116,10 @@ FILE fqName: fileName:/delegatedPropertiesOperators.kt VALUE_PARAMETER name: index:0 type:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (: kotlin.String): kotlin.Unit declared in .Result' - CALL 'public final fun setValue (: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: kotlin.String): kotlin.Unit [operator] declared in .Delegate' type=kotlin.Unit origin=null + CALL 'public final fun setValue (_context_receiver_0: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: kotlin.String): kotlin.Unit [operator] declared in .Delegate' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:s$delegate type:.Delegate visibility:private [final]' type=.Delegate origin=null receiver: GET_VAR ': .Result declared in .Result.' type=.Result origin=null - : GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + _context_receiver_0: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null receiver: GET_VAR ': .Result declared in .Result.' type=.Result origin=null thisRef: GET_VAR ': .Result declared in .Result.' type=.Result origin=null property: PROPERTY_REFERENCE 'public final s: kotlin.String [delegated,var]' field=null getter='public final fun (): kotlin.String declared in .Result' setter='public final fun (: kotlin.String): kotlin.Unit declared in .Result' type=kotlin.reflect.KMutableProperty1<.Result, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.kt.txt index 11be2b4037c..75ae8df8c4b 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/delegatedPropertiesOperators.kt.txt @@ -15,16 +15,16 @@ class Delegate { get set - operator fun getValue(: Int, thisRef: Any?, property: KProperty<*>): String { + operator fun getValue(_context_receiver_0: Int, thisRef: Any?, property: KProperty<*>): String { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return .() } - operator fun setValue(: Int, thisRef: Any?, property: KProperty<*>, value: String) { + operator fun setValue(_context_receiver_0: Int, thisRef: Any?, property: KProperty<*>, value: String) { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } .( = value) } @@ -43,10 +43,10 @@ class Result { var s: String /* by */ field = Delegate() get(): String { - return .#s$delegate.getValue( = .#contextReceiverField0, thisRef = , property = Result::s) + return .#s$delegate.getValue(_context_receiver_0 = .#contextReceiverField0, thisRef = , property = Result::s) } set(: String) { - return .#s$delegate.setValue( = .#contextReceiverField0, thisRef = , property = Result::s, value = ) + return .#s$delegate.setValue(_context_receiver_0 = .#contextReceiverField0, thisRef = , property = Result::s, value = ) } } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.ir.txt index bfb8c984d18..05866f85100 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.ir.txt @@ -20,10 +20,10 @@ FILE fqName: fileName:/canvas.kt $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:Shape modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Shape - FUN name:draw visibility:public modality:ABSTRACT <> ($this:.Shape, :.Canvas) returnType:kotlin.String + FUN name:draw visibility:public modality:ABSTRACT <> ($this:.Shape, _context_receiver_0:.Canvas) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.Shape contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.Canvas + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Canvas FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any @@ -43,18 +43,18 @@ FILE fqName: fileName:/canvas.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Circle modality:FINAL visibility:public superTypes:[.Shape]' - FUN name:draw visibility:public modality:OPEN <> ($this:.Circle, :.Canvas) returnType:kotlin.String + FUN name:draw visibility:public modality:OPEN <> ($this:.Circle, _context_receiver_0:.Canvas) returnType:kotlin.String overridden: - public abstract fun draw (: .Canvas): kotlin.String declared in .Shape + public abstract fun draw (_context_receiver_0: .Canvas): kotlin.String declared in .Shape $this: VALUE_PARAMETER name: type:.Circle contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.Canvas + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Canvas BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun draw (: .Canvas): kotlin.String declared in .Circle' + RETURN type=kotlin.Nothing from='public open fun draw (_context_receiver_0: .Canvas): kotlin.String declared in .Circle' CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS $this: CONST String type=kotlin.String value="OK" other: CALL 'public abstract fun (): kotlin.String declared in .Canvas' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Canvas declared in .Circle.draw' type=.Canvas origin=null + $this: GET_VAR '_context_receiver_0: .Canvas declared in .Circle.draw' type=.Canvas origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Shape @@ -114,6 +114,6 @@ FILE fqName: fileName:/canvas.kt $receiver: VALUE_PARAMETER name:$this$with type:.MyCanvas BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public open fun draw (: .Canvas): kotlin.String declared in .Circle' type=kotlin.String origin=null + CALL 'public open fun draw (_context_receiver_0: .Canvas): kotlin.String declared in .Circle' type=kotlin.String origin=null $this: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Circle' type=.Circle origin=null - : GET_VAR '$this$with: .MyCanvas declared in .box.' type=.MyCanvas origin=null + _context_receiver_0: GET_VAR '$this$with: .MyCanvas declared in .box.' type=.MyCanvas origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.kt.txt index facee9860e2..de3ee4a56ad 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.kt.txt @@ -5,7 +5,7 @@ interface Canvas { } interface Shape { - abstract fun draw(: Canvas): String + abstract fun draw(_context_receiver_0: Canvas): String } @@ -16,8 +16,8 @@ class Circle : Shape { } - override fun draw(: Canvas): String { - return "OK".plus(other = .()) + override fun draw(_context_receiver_0: Canvas): String { + return "OK".plus(other = _context_receiver_0.()) } } @@ -37,7 +37,7 @@ object MyCanvas : Canvas { fun box(): String { return with(receiver = MyCanvas, block = local fun MyCanvas.(): String { - return Circle().draw( = $this$with) + return Circle().draw(_context_receiver_0 = $this$with) } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.txt deleted file mode 100644 index 626d2a2c5ad..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/canvas.txt +++ /dev/null @@ -1,117 +0,0 @@ -FILE fqName: fileName:/canvas.kt - CLASS INTERFACE name:Canvas modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Canvas - PROPERTY name:suffix visibility:public modality:ABSTRACT [val] - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Canvas) returnType:kotlin.String - correspondingProperty: PROPERTY name:suffix visibility:public modality:ABSTRACT [val] - $this: VALUE_PARAMETER name: type:.Canvas - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS INTERFACE name:Shape modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Shape - FUN name:draw visibility:public modality:ABSTRACT <> ($this:.Shape, :.Canvas) returnType:kotlin.String - $this: VALUE_PARAMETER name: type:.Shape - VALUE_PARAMETER name: index:0 type:.Canvas - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:Circle modality:FINAL visibility:public superTypes:[.Shape] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Circle - CONSTRUCTOR visibility:public <> () returnType:.Circle [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Circle modality:FINAL visibility:public superTypes:[.Shape]' - FUN name:draw visibility:public modality:OPEN <> ($this:.Circle, :.Canvas) returnType:kotlin.String - overridden: - public abstract fun draw (: .Canvas): kotlin.String declared in .Shape - $this: VALUE_PARAMETER name: type:.Circle - VALUE_PARAMETER name: index:0 type:.Canvas - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun draw (: .Canvas): kotlin.String declared in .Circle' - CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS - $this: CONST String type=kotlin.String value="OK" - other: CALL 'public abstract fun (): kotlin.String declared in .Canvas' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Canvas declared in .Circle.draw' type=.Canvas origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Shape - $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 [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .Shape - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .Shape - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS OBJECT name:MyCanvas modality:FINAL visibility:public superTypes:[.Canvas] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyCanvas - CONSTRUCTOR visibility:private <> () returnType:.MyCanvas [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:MyCanvas modality:FINAL visibility:public superTypes:[.Canvas]' - PROPERTY name:suffix visibility:public modality:OPEN [val] - overridden: - public abstract suffix: kotlin.String [val] - FIELD PROPERTY_BACKING_FIELD name:suffix type:kotlin.String visibility:private [final] - EXPRESSION_BODY - CONST String type=kotlin.String value="" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.MyCanvas) returnType:kotlin.String - correspondingProperty: PROPERTY name:suffix visibility:public modality:OPEN [val] - overridden: - public abstract fun (): kotlin.String declared in .Canvas - $this: VALUE_PARAMETER name: type:.MyCanvas - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .MyCanvas' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:suffix type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .MyCanvas declared in .MyCanvas.' type=.MyCanvas origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Canvas - $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 [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .Canvas - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .Canvas - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null - : .MyCanvas - : kotlin.String - receiver: GET_OBJECT 'CLASS OBJECT name:MyCanvas modality:FINAL visibility:public superTypes:[.Canvas]' type=.MyCanvas - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.MyCanvas, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.MyCanvas) returnType:kotlin.String - $receiver: VALUE_PARAMETER name:$this$with type:.MyCanvas - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public open fun draw (: .Canvas): kotlin.String declared in .Circle' type=kotlin.String origin=null - $this: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Circle' type=.Circle origin=null - : GET_VAR '$this$with: .MyCanvas declared in .box.' type=.MyCanvas origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.ir.txt index 4af2d69c219..c06ca9d30f3 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.ir.txt @@ -157,35 +157,35 @@ FILE fqName: fileName:/compareTo.kt CONST Boolean type=kotlin.Boolean value=false RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Pair' CONST Boolean type=kotlin.Boolean value=true - FUN name:compareTo visibility:public modality:FINAL ($receiver:T of .compareTo, :java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other:T of .compareTo) returnType:kotlin.Int [operator,infix] + FUN name:compareTo visibility:public modality:FINAL ($receiver:T of .compareTo, _context_receiver_0:java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other:T of .compareTo) returnType:kotlin.Int [operator,infix] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:T of .compareTo - VALUE_PARAMETER name: index:0 type:java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } + VALUE_PARAMETER name:_context_receiver_0 index:0 type:java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } VALUE_PARAMETER name:other index:1 type:T of .compareTo BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun compareTo (: java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other: T of .compareTo): kotlin.Int [operator,infix] declared in ' + RETURN type=kotlin.Nothing from='public final fun compareTo (_context_receiver_0: java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other: T of .compareTo): kotlin.Int [operator,infix] declared in ' CALL 'public abstract fun compare (p0: @[FlexibleNullability] T of java.util.Comparator?, p1: @[FlexibleNullability] T of java.util.Comparator?): kotlin.Int declared in java.util.Comparator' type=kotlin.Int origin=null - $this: GET_VAR ': java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } declared in .compareTo' type=java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } origin=null + $this: GET_VAR '_context_receiver_0: java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } declared in .compareTo' type=java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> } origin=null p0: GET_VAR ': T of .compareTo declared in .compareTo' type=T of .compareTo origin=null p1: GET_VAR 'other: T of .compareTo declared in .compareTo' type=T of .compareTo origin=null PROPERTY name:min visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL ($receiver:.Pair., T of .>, :java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }) returnType:T of . + FUN name: visibility:public modality:FINAL ($receiver:.Pair., T of .>, _context_receiver_0:java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }) returnType:T of . correspondingProperty: PROPERTY name:min visibility:public modality:FINAL [val] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Pair., T of .> - VALUE_PARAMETER name: index:0 type:java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } + VALUE_PARAMETER name:_context_receiver_0 index:0 type:java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (: java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }): T of . declared in ' + RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }): T of . declared in ' WHEN type=T of . origin=IF BRANCH if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT - arg0: CALL 'public final fun compareTo (: java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other: T of .compareTo): kotlin.Int [operator,infix] declared in ' type=kotlin.Int origin=LT + arg0: CALL 'public final fun compareTo (_context_receiver_0: java.util.Comparator.compareTo>{ kotlin.TypeAliasesKt.Comparator.compareTo> }, other: T of .compareTo): kotlin.Int [operator,infix] declared in ' type=kotlin.Int origin=LT : T of . $receiver: CALL 'public final fun (): A of .Pair declared in .Pair' type=T of . origin=GET_PROPERTY $this: GET_VAR ': .Pair., T of .> declared in .' type=.Pair., T of .> origin=null - : GET_VAR ': java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } declared in .' type=java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } origin=null + _context_receiver_0: GET_VAR '_context_receiver_0: java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } declared in .' type=java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> } origin=null other: CALL 'public final fun (): B of .Pair declared in .Pair' type=T of . origin=GET_PROPERTY $this: GET_VAR ': .Pair., T of .> declared in .' type=.Pair., T of .> origin=null arg1: CONST Int type=kotlin.Int value=0 @@ -238,11 +238,11 @@ FILE fqName: fileName:/compareTo.kt $receiver: VALUE_PARAMETER name:$this$with type:java.util.Comparator BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public final fun (: java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }): T of . declared in ' type=kotlin.String origin=GET_PROPERTY + CALL 'public final fun (_context_receiver_0: java.util.Comparator.>{ kotlin.TypeAliasesKt.Comparator.> }): T of . declared in ' type=kotlin.String origin=GET_PROPERTY : kotlin.String $receiver: CONSTRUCTOR_CALL 'public constructor (first: A of .Pair, second: B of .Pair) [primary] declared in .Pair' type=.Pair origin=null : kotlin.String : kotlin.String first: CONST String type=kotlin.String value="OK" second: CONST String type=kotlin.String value="fail" - : GET_VAR '$this$with: java.util.Comparator declared in .box.' type=java.util.Comparator origin=null + _context_receiver_0: GET_VAR '$this$with: java.util.Comparator declared in .box.' type=java.util.Comparator origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.kt.txt index fc750cb664f..8f3411c683d 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.kt.txt @@ -60,14 +60,14 @@ data class Pair { } -infix operator fun T.compareTo(: Comparator, other: T): Int { - return .compare(p0 = , p1 = other) +infix operator fun T.compareTo(_context_receiver_0: Comparator, other: T): Int { + return _context_receiver_0.compare(p0 = , p1 = other) } val Pair.min: T - get(: Comparator): T { + get(_context_receiver_0: Comparator): T { return when { - less(arg0 = .().compareTo( = , other = .()), arg1 = 0) -> .() + less(arg0 = .().compareTo(_context_receiver_0 = _context_receiver_0, other = .()), arg1 = 0) -> .() else -> .() } } @@ -84,7 +84,7 @@ fun box(): String { } /*-> Comparator */ return with, String>(receiver = comparator, block = local fun Comparator.(): String { - return Pair(first = "OK", second = "fail").( = $this$with) + return Pair(first = "OK", second = "fail").(_context_receiver_0 = $this$with) } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.ir.txt index 58190c807bf..27036eca7aa 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.ir.txt @@ -30,16 +30,16 @@ FILE fqName: fileName:/dp.kt public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any PROPERTY name:dp visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($receiver:kotlin.Int, :.View) returnType:kotlin.Int + FUN name: visibility:public modality:FINAL <> ($receiver:kotlin.Int, _context_receiver_0:.View) returnType:kotlin.Int correspondingProperty: PROPERTY name:dp visibility:public modality:FINAL [val] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name: index:0 type:.View + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.View BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (: .View): kotlin.Int declared in ' + RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: .View): kotlin.Int declared in ' CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL $this: CALL 'public final fun (): kotlin.Int declared in .View' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .View declared in .' type=.View origin=null + $this: GET_VAR '_context_receiver_0: .View declared in .' type=.View origin=null other: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY @@ -68,9 +68,9 @@ FILE fqName: fileName:/dp.kt VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Int declared in .box.' - CALL 'public final fun (: .View): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY + CALL 'public final fun (_context_receiver_0: .View): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY $receiver: GET_VAR 'it: kotlin.Int declared in .box..' type=kotlin.Int origin=null - : GET_VAR '$this$with: .View declared in .box.' type=.View origin=null + _context_receiver_0: GET_VAR '$this$with: .View declared in .box.' type=.View origin=null arg1: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null : kotlin.Int elements: VARARG type=kotlin.Array varargElementType=kotlin.Int diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.kt.txt index 8bf3626edcf..d1ac2e8dcc9 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.kt.txt @@ -12,15 +12,15 @@ class View { } val Int.dp: Int - get(: View): Int { - return .().times(other = ) + get(_context_receiver_0: View): Int { + return _context_receiver_0.().times(other = ) } fun box(): String { with(receiver = View(), block = local fun View.(): Nothing { when { EQEQ(arg0 = listOf(elements = [1, 2, 10]).map(transform = local fun (it: Int): Int { - return it.( = $this$with) + return it.(_context_receiver_0 = $this$with) } ), arg1 = listOf(elements = [42, 84, 420])) -> { // BLOCK return "OK" diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.txt deleted file mode 100644 index d892d912efc..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/dp.txt +++ /dev/null @@ -1,83 +0,0 @@ -FILE fqName: fileName:/dp.kt - CLASS CLASS name:View modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.View - CONSTRUCTOR visibility:public <> () returnType:.View [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:View modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:coefficient visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:coefficient type:kotlin.Int visibility:private [final] - EXPRESSION_BODY - CONST Int type=kotlin.Int value=42 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.View) returnType:kotlin.Int - correspondingProperty: PROPERTY name:coefficient visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.View - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .View' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coefficient type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .View declared in .View.' type=.View origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - PROPERTY name:dp visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($receiver:kotlin.Int, :.View) returnType:kotlin.Int - correspondingProperty: PROPERTY name:dp visibility:public modality:FINAL [val] - $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name: index:0 type:.View - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (: .View): kotlin.Int declared in ' - CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL - $this: CALL 'public final fun (): kotlin.Int declared in .View' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .View declared in .' type=.View origin=null - other: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null - FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null - : .View - : kotlin.Nothing - receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .View' type=.View origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.View, kotlin.Nothing> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.View) returnType:kotlin.Nothing - $receiver: VALUE_PARAMETER name:$this$with type:.View - BLOCK_BODY - WHEN type=kotlin.Unit origin=IF - BRANCH - if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: CALL 'public final fun map (transform: kotlin.Function1): kotlin.collections.List [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null - : kotlin.Int - : kotlin.Int - $receiver: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null - : kotlin.Int - elements: VARARG type=kotlin.Array varargElementType=kotlin.Int - CONST Int type=kotlin.Int value=1 - CONST Int type=kotlin.Int value=2 - CONST Int type=kotlin.Int value=10 - transform: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Int - VALUE_PARAMETER name:it index:0 type:kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Int declared in .box.' - CALL 'public final fun (: .View): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY - $receiver: GET_VAR 'it: kotlin.Int declared in .box..' type=kotlin.Int origin=null - : GET_VAR '$this$with: .View declared in .box.' type=.View origin=null - arg1: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null - : kotlin.Int - elements: VARARG type=kotlin.Array varargElementType=kotlin.Int - CONST Int type=kotlin.Int value=42 - CONST Int type=kotlin.Int value=84 - CONST Int type=kotlin.Int value=420 - then: BLOCK type=kotlin.Unit origin=null - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - CONST String type=kotlin.String value="OK" - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - CONST String type=kotlin.String value="fail" diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.ir.txt index a3ba573865f..ba4609e7339 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.ir.txt @@ -78,17 +78,17 @@ FILE fqName: fileName:/functionalType.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL ($receiver:.K, :.O, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>) returnType:T of .f + FUN name:f visibility:public modality:FINAL ($receiver:.K, _context_receiver_0:.O, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>) returnType:T of .f TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.K - VALUE_PARAMETER name: index:0 type:.O + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.O VALUE_PARAMETER name:g index:1 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun f (: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' + RETURN type=kotlin.Nothing from='public final fun f (_context_receiver_0: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' CALL 'public abstract fun invoke (p1: P1 of kotlin.Function3, p2: P2 of kotlin.Function3, p3: P3 of kotlin.Function3): R of kotlin.Function3 [operator] declared in kotlin.Function3' type=T of .f origin=INVOKE $this: GET_VAR 'g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> declared in .f' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .O declared in .f' type=.O origin=null + p1: GET_VAR '_context_receiver_0: .O declared in .f' type=.O origin=null p2: GET_VAR ': .K declared in .f' type=.K origin=null p3: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Param' type=.Param origin=null FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String @@ -103,18 +103,18 @@ FILE fqName: fileName:/functionalType.kt $receiver: VALUE_PARAMETER name:$this$with type:.O BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public final fun f (: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' type=kotlin.String origin=null + CALL 'public final fun f (_context_receiver_0: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' type=kotlin.String origin=null : kotlin.String $receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K' type=.K origin=null - : GET_VAR '$this$with: .O declared in .box.' type=.O origin=null + _context_receiver_0: GET_VAR '$this$with: .O declared in .box.' type=.O origin=null g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.K, :.O, it:.Param) returnType:kotlin.String + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.K, _context_receiver_0:.O, it:.Param) returnType:kotlin.String contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name:$this$f type:.K - VALUE_PARAMETER name: index:0 type:.O + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.O VALUE_PARAMETER name:it index:1 type:.Param BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (: .O, it: .Param): kotlin.String declared in .box.' + RETURN type=kotlin.Nothing from='local final fun (_context_receiver_0: .O, it: .Param): kotlin.String declared in .box.' CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS $this: CALL 'public final fun (): kotlin.String declared in .O' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '$this$with: .O declared in .box.' type=.O origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.kt.txt index 209941c1486..6d40259b705 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.kt.txt @@ -33,13 +33,13 @@ class K { } -fun K.f(: O, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3): T { - return g.invoke(p1 = , p2 = , p3 = Param()) +fun K.f(_context_receiver_0: O, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3): T { + return g.invoke(p1 = _context_receiver_0, p2 = , p3 = Param()) } fun box(): String { return with(receiver = O(), block = local fun O.(): String { - return K().f( = $this$with, g = local fun K.(: O, it: Param): String { + return K().f(_context_receiver_0 = $this$with, g = local fun K.(_context_receiver_0: O, it: Param): String { return $this$with.().plus(other = $this$f.()) } ) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.txt deleted file mode 100644 index d7826db9cab..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/functionalType.txt +++ /dev/null @@ -1,121 +0,0 @@ -FILE fqName: fileName:/functionalType.kt - CLASS CLASS name:Param modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Param - CONSTRUCTOR visibility:public <> () returnType:.Param [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Param modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:O modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.O - CONSTRUCTOR visibility:public <> () returnType:.O [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:O modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:o visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:o type:kotlin.String visibility:private [final] - EXPRESSION_BODY - CONST String type=kotlin.String value="O" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.O) returnType:kotlin.String - correspondingProperty: PROPERTY name:o visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.O - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .O' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:o type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .O declared in .O.' type=.O origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:K modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.K - CONSTRUCTOR visibility:public <> () returnType:.K [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:k visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:k type:kotlin.String visibility:private [final] - EXPRESSION_BODY - CONST String type=kotlin.String value="K" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.K) returnType:kotlin.String - correspondingProperty: PROPERTY name:k visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.K - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .K' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:k type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .K declared in .K.' type=.K origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL ($receiver:.K, :.O, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>) returnType:T of .f - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - $receiver: VALUE_PARAMETER name: type:.K - VALUE_PARAMETER name: index:0 type:.O - VALUE_PARAMETER name:g index:1 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun f (: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' - CALL 'public abstract fun invoke (p1: P1 of kotlin.Function3, p2: P2 of kotlin.Function3, p3: P3 of kotlin.Function3): R of kotlin.Function3 [operator] declared in kotlin.Function3' type=T of .f origin=INVOKE - $this: GET_VAR 'g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> declared in .f' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .O declared in .f' type=.O origin=null - p2: GET_VAR ': .K declared in .f' type=.K origin=null - p3: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Param' type=.Param origin=null - FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null - : .O - : kotlin.String - receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .O' type=.O origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.O, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.O) returnType:kotlin.String - $receiver: VALUE_PARAMETER name:$this$with type:.O - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public final fun f (: .O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, T of .f>): T of .f declared in ' type=kotlin.String origin=null - : kotlin.String - $receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K' type=.K origin=null - : TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, kotlin.String> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, kotlin.String> - GET_VAR '$this$with: .O declared in .box.' type=.O origin=null - g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.O, .K, .Param, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.K, :.O, it:.Param) returnType:kotlin.String - $receiver: VALUE_PARAMETER name:$this$f type:.K - VALUE_PARAMETER name: index:0 type:.O - VALUE_PARAMETER name:it index:1 type:.Param - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (: .O, it: .Param): kotlin.String declared in .box.' - CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS - $this: CALL 'public final fun (): kotlin.String declared in .O' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR '$this$with: .O declared in .box.' type=.O origin=null - other: CALL 'public final fun (): kotlin.String declared in .K' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR '$this$f: .K declared in .box..' type=.K origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.ir.txt index 2cbf264a7a5..467fc89907e 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.ir.txt @@ -135,19 +135,19 @@ FILE fqName: fileName:/monoidSum.kt overridden: public open fun toString (): kotlin.String [fake_override] declared in .Monoid $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:sum visibility:public modality:FINAL ($receiver:kotlin.collections.List.sum>, :.Monoid.sum>) returnType:T of .sum + FUN name:sum visibility:public modality:FINAL ($receiver:kotlin.collections.List.sum>, _context_receiver_0:.Monoid.sum>) returnType:T of .sum TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:kotlin.collections.List.sum> - VALUE_PARAMETER name: index:0 type:.Monoid.sum> + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Monoid.sum> BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun sum (: .Monoid.sum>): T of .sum declared in ' + RETURN type=kotlin.Nothing from='public final fun sum (_context_receiver_0: .Monoid.sum>): T of .sum declared in ' CALL 'public final fun fold (initial: R of kotlin.collections.CollectionsKt.fold, operation: kotlin.Function2<@[ParameterName(name = 'acc')] R of kotlin.collections.CollectionsKt.fold, T of kotlin.collections.CollectionsKt.fold, R of kotlin.collections.CollectionsKt.fold>): R of kotlin.collections.CollectionsKt.fold [inline] declared in kotlin.collections.CollectionsKt' type=T of .sum origin=null : T of .sum : T of .sum $receiver: GET_VAR ': kotlin.collections.List.sum> declared in .sum' type=kotlin.collections.List.sum> origin=null initial: CALL 'public abstract fun (): T of .Monoid declared in .Monoid' type=T of .sum origin=GET_PROPERTY - $this: GET_VAR ': .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null + $this: GET_VAR '_context_receiver_0: .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null operation: FUN_EXPR type=kotlin.Function2<@[ParameterName(name = 'acc')] T of .sum, T of .sum, T of .sum> origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (acc:T of .sum, e:T of .sum) returnType:T of .sum VALUE_PARAMETER name:acc index:0 type:T of .sum @@ -155,7 +155,7 @@ FILE fqName: fileName:/monoidSum.kt BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (acc: T of .sum, e: T of .sum): T of .sum declared in .sum' CALL 'public abstract fun combine (other: T of .Monoid): T of .Monoid [fake_override,infix] declared in .Monoid' type=T of .sum origin=null - $this: GET_VAR ': .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null + $this: GET_VAR '_context_receiver_0: .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null $receiver: GET_VAR 'acc: T of .sum declared in .sum.' type=T of .sum origin=null other: GET_VAR 'e: T of .sum declared in .sum.' type=T of .sum origin=null FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String @@ -170,7 +170,7 @@ FILE fqName: fileName:/monoidSum.kt $receiver: VALUE_PARAMETER name:$this$with type:.IntMonoid BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .box' - CALL 'public final fun sum (: .Monoid.sum>): T of .sum declared in ' type=kotlin.Int origin=null + CALL 'public final fun sum (_context_receiver_0: .Monoid.sum>): T of .sum declared in ' type=kotlin.Int origin=null : kotlin.Int $receiver: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null : kotlin.Int @@ -178,7 +178,7 @@ FILE fqName: fileName:/monoidSum.kt CONST Int type=kotlin.Int value=1 CONST Int type=kotlin.Int value=2 CONST Int type=kotlin.Int value=3 - : GET_VAR '$this$with: .IntMonoid declared in .box.' type=.IntMonoid origin=null + _context_receiver_0: GET_VAR '$this$with: .IntMonoid declared in .box.' type=.IntMonoid origin=null RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null : .StringMonoid @@ -189,11 +189,11 @@ FILE fqName: fileName:/monoidSum.kt $receiver: VALUE_PARAMETER name:$this$with type:.StringMonoid BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public final fun sum (: .Monoid.sum>): T of .sum declared in ' type=kotlin.String origin=null + CALL 'public final fun sum (_context_receiver_0: .Monoid.sum>): T of .sum declared in ' type=kotlin.String origin=null : kotlin.String $receiver: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null : kotlin.String elements: VARARG type=kotlin.Array varargElementType=kotlin.String CONST String type=kotlin.String value="O" CONST String type=kotlin.String value="K" - : GET_VAR '$this$with: .StringMonoid declared in .box.' type=.StringMonoid origin=null + _context_receiver_0: GET_VAR '$this$with: .StringMonoid declared in .box.' type=.StringMonoid origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.kt.txt index 542b8284b8c..4fe6b98b2c3 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.kt.txt @@ -43,20 +43,20 @@ object StringMonoid : Monoid { } -fun List.sum(: Monoid): T { - return .fold(initial = .(), operation = local fun (acc: T, e: T): T { - return (, acc).combine(other = e) +fun List.sum(_context_receiver_0: Monoid): T { + return .fold(initial = _context_receiver_0.(), operation = local fun (acc: T, e: T): T { + return (_context_receiver_0, acc).combine(other = e) } ) } fun box(): String { with(receiver = IntMonoid, block = local fun IntMonoid.(): Int { - return listOf(elements = [1, 2, 3]).sum( = $this$with) + return listOf(elements = [1, 2, 3]).sum(_context_receiver_0 = $this$with) } ) /*~> Unit */ return with(receiver = StringMonoid, block = local fun StringMonoid.(): String { - return listOf(elements = ["O", "K"]).sum( = $this$with) + return listOf(elements = ["O", "K"]).sum(_context_receiver_0 = $this$with) } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.txt deleted file mode 100644 index 50d56a6e1e4..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.txt +++ /dev/null @@ -1,198 +0,0 @@ -FILE fqName: fileName:/monoidSum.kt - CLASS INTERFACE name:Semigroup modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Semigroup.Semigroup> - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - FUN name:combine visibility:public modality:ABSTRACT <> ($this:.Semigroup.Semigroup>, $receiver:T of .Semigroup, other:T of .Semigroup) returnType:T of .Semigroup [infix] - $this: VALUE_PARAMETER name: type:.Semigroup.Semigroup> - $receiver: VALUE_PARAMETER name: type:T of .Semigroup - VALUE_PARAMETER name:other index:0 type:T of .Semigroup - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS INTERFACE name:Monoid modality:ABSTRACT visibility:public superTypes:[.Semigroup.Monoid>] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Monoid.Monoid> - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - PROPERTY name:unit visibility:public modality:ABSTRACT [val] - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Monoid.Monoid>) returnType:T of .Monoid - correspondingProperty: PROPERTY name:unit visibility:public modality:ABSTRACT [val] - $this: VALUE_PARAMETER name: type:.Monoid.Monoid> - FUN FAKE_OVERRIDE name:combine visibility:public modality:ABSTRACT <> ($this:.Semigroup.Monoid>, $receiver:T of .Monoid, other:T of .Monoid) returnType:T of .Monoid [fake_override,infix] - overridden: - public abstract fun combine (other: T of .Semigroup): T of .Semigroup [infix] declared in .Semigroup - $this: VALUE_PARAMETER name: type:.Semigroup.Monoid> - $receiver: VALUE_PARAMETER name: type:T of .Monoid - VALUE_PARAMETER name:other index:0 type:T of .Monoid - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Semigroup - $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 [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .Semigroup - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .Semigroup - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS OBJECT name:IntMonoid modality:FINAL visibility:public superTypes:[.Monoid] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IntMonoid - CONSTRUCTOR visibility:private <> () returnType:.IntMonoid [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:IntMonoid modality:FINAL visibility:public superTypes:[.Monoid]' - FUN name:combine visibility:public modality:OPEN <> ($this:.IntMonoid, $receiver:kotlin.Int, other:kotlin.Int) returnType:kotlin.Int [infix] - overridden: - public abstract fun combine (other: T of .Monoid): T of .Monoid [fake_override,infix] declared in .Monoid - $this: VALUE_PARAMETER name: type:.IntMonoid - $receiver: VALUE_PARAMETER name: type:kotlin.Int - VALUE_PARAMETER name:other index:0 type:kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun combine (other: kotlin.Int): kotlin.Int [infix] declared in .IntMonoid' - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: GET_VAR ': kotlin.Int declared in .IntMonoid.combine' type=kotlin.Int origin=null - other: GET_VAR 'other: kotlin.Int declared in .IntMonoid.combine' type=kotlin.Int origin=null - PROPERTY name:unit visibility:public modality:OPEN [val] - overridden: - public abstract unit: T of .Monoid [val] - FIELD PROPERTY_BACKING_FIELD name:unit type:kotlin.Int visibility:private [final] - EXPRESSION_BODY - CONST Int type=kotlin.Int value=0 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.IntMonoid) returnType:kotlin.Int - correspondingProperty: PROPERTY name:unit visibility:public modality:OPEN [val] - overridden: - public abstract fun (): T of .Monoid declared in .Monoid - $this: VALUE_PARAMETER name: type:.IntMonoid - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .IntMonoid' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:unit type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .IntMonoid declared in .IntMonoid.' type=.IntMonoid origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Monoid - $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 [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .Monoid - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .Monoid - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS OBJECT name:StringMonoid modality:FINAL visibility:public superTypes:[.Monoid] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.StringMonoid - CONSTRUCTOR visibility:private <> () returnType:.StringMonoid [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:StringMonoid modality:FINAL visibility:public superTypes:[.Monoid]' - FUN name:combine visibility:public modality:OPEN <> ($this:.StringMonoid, $receiver:kotlin.String, other:kotlin.String) returnType:kotlin.String [infix] - overridden: - public abstract fun combine (other: T of .Monoid): T of .Monoid [fake_override,infix] declared in .Monoid - $this: VALUE_PARAMETER name: type:.StringMonoid - $receiver: VALUE_PARAMETER name: type:kotlin.String - VALUE_PARAMETER name:other index:0 type:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun combine (other: kotlin.String): kotlin.String [infix] declared in .StringMonoid' - CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS - $this: GET_VAR ': kotlin.String declared in .StringMonoid.combine' type=kotlin.String origin=null - other: GET_VAR 'other: kotlin.String declared in .StringMonoid.combine' type=kotlin.String origin=null - PROPERTY name:unit visibility:public modality:OPEN [val] - overridden: - public abstract unit: T of .Monoid [val] - FIELD PROPERTY_BACKING_FIELD name:unit type:kotlin.String visibility:private [final] - EXPRESSION_BODY - CONST String type=kotlin.String value="" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.StringMonoid) returnType:kotlin.String - correspondingProperty: PROPERTY name:unit visibility:public modality:OPEN [val] - overridden: - public abstract fun (): T of .Monoid declared in .Monoid - $this: VALUE_PARAMETER name: type:.StringMonoid - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .StringMonoid' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:unit type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .StringMonoid declared in .StringMonoid.' type=.StringMonoid origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .Monoid - $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 [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .Monoid - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .Monoid - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:sum visibility:public modality:FINAL ($receiver:kotlin.collections.List.sum>, :.Monoid.sum>) returnType:T of .sum - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - $receiver: VALUE_PARAMETER name: type:kotlin.collections.List.sum> - VALUE_PARAMETER name: index:0 type:.Monoid.sum> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun sum (: .Monoid.sum>): T of .sum declared in ' - CALL 'public final fun fold (initial: R of kotlin.collections.CollectionsKt.fold, operation: kotlin.Function2<@[ParameterName(name = 'acc')] R of kotlin.collections.CollectionsKt.fold, T of kotlin.collections.CollectionsKt.fold, R of kotlin.collections.CollectionsKt.fold>): R of kotlin.collections.CollectionsKt.fold [inline] declared in kotlin.collections.CollectionsKt' type=T of .sum origin=null - : T of .sum - : T of .sum - $receiver: GET_VAR ': kotlin.collections.List.sum> declared in .sum' type=kotlin.collections.List.sum> origin=null - initial: CALL 'public abstract fun (): T of .Monoid declared in .Monoid' type=T of .sum origin=GET_PROPERTY - $this: GET_VAR ': .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null - operation: FUN_EXPR type=kotlin.Function2<@[ParameterName(name = 'acc')] T of .sum, T of .sum, T of .sum> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (acc:T of .sum, e:T of .sum) returnType:T of .sum - VALUE_PARAMETER name:acc index:0 type:T of .sum - VALUE_PARAMETER name:e index:1 type:T of .sum - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (acc: T of .sum, e: T of .sum): T of .sum declared in .sum' - CALL 'public abstract fun combine (other: T of .Monoid): T of .Monoid [fake_override,infix] declared in .Monoid' type=T of .sum origin=null - $this: GET_VAR ': .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null - $receiver: GET_VAR 'acc: T of .sum declared in .sum.' type=T of .sum origin=null - other: GET_VAR 'e: T of .sum declared in .sum.' type=T of .sum origin=null - FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Int origin=null - : .IntMonoid - : kotlin.Int - receiver: GET_OBJECT 'CLASS OBJECT name:IntMonoid modality:FINAL visibility:public superTypes:[.Monoid]' type=.IntMonoid - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.IntMonoid, kotlin.Int> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.IntMonoid) returnType:kotlin.Int - $receiver: VALUE_PARAMETER name:$this$with type:.IntMonoid - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .box' - CALL 'public final fun sum (: .Monoid.sum>): T of .sum declared in ' type=kotlin.Int origin=null - : kotlin.Int - $receiver: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null - : kotlin.Int - elements: VARARG type=kotlin.Array varargElementType=kotlin.Int - CONST Int type=kotlin.Int value=1 - CONST Int type=kotlin.Int value=2 - CONST Int type=kotlin.Int value=3 - : GET_VAR '$this$with: .IntMonoid declared in .box.' type=.IntMonoid origin=null - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null - : .StringMonoid - : kotlin.String - receiver: GET_OBJECT 'CLASS OBJECT name:StringMonoid modality:FINAL visibility:public superTypes:[.Monoid]' type=.StringMonoid - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.StringMonoid, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.StringMonoid) returnType:kotlin.String - $receiver: VALUE_PARAMETER name:$this$with type:.StringMonoid - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' - CALL 'public final fun sum (: .Monoid.sum>): T of .sum declared in ' type=kotlin.String origin=null - : kotlin.String - $receiver: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.String - CONST String type=kotlin.String value="O" - CONST String type=kotlin.String value="K" - : GET_VAR '$this$with: .StringMonoid declared in .box.' type=.StringMonoid origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.ir.txt deleted file mode 100644 index 2cefb5b030d..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.ir.txt +++ /dev/null @@ -1,51 +0,0 @@ -FILE fqName: fileName:/function.kt - CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C - CONSTRUCTOR visibility:public <> () returnType:.C [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:c visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final] - EXPRESSION_BODY - CONST Int type=kotlin.Int value=42 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int - correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.C - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .C declared in .C.' type=.C origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:.C) returnType:kotlin.Unit - contextReceiverParametersCount: 1 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_0: .C declared in .foo' type=.C origin=null - FUN name:bar visibility:public modality:FINAL <> (c:.C) returnType:kotlin.Unit - VALUE_PARAMETER name:c index:0 type:.C - BLOCK_BODY - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null - : .C - : kotlin.Unit - receiver: GET_VAR 'c: .C declared in .bar' type=.C origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.C, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.C) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name:$this$with type:.C - BLOCK_BODY - CALL 'public final fun foo (_context_receiver_0: .C): kotlin.Unit declared in ' type=kotlin.Unit origin=null - _context_receiver_0: GET_VAR '$this$with: .C declared in .bar.' type=.C origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.kt.txt deleted file mode 100644 index a2b63fa51c5..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.fir.kt.txt +++ /dev/null @@ -1,23 +0,0 @@ -class C { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - - val c: Int - field = 42 - get - -} - -fun foo(_context_receiver_0: C) { - _context_receiver_0.() /*~> Unit */ -} - -fun bar(c: C) { - with(receiver = c, block = local fun C.() { - foo(_context_receiver_0 = $this$with) - } -) -} diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/function.ir.txt index 40a1a0ee1f1..2cefb5b030d 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/function.ir.txt @@ -29,13 +29,13 @@ FILE fqName: fileName:/function.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:foo visibility:public modality:FINAL <> (:.C) returnType:kotlin.Unit + FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:.C) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .foo' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .foo' type=.C origin=null FUN name:bar visibility:public modality:FINAL <> (c:.C) returnType:kotlin.Unit VALUE_PARAMETER name:c index:0 type:.C BLOCK_BODY @@ -47,5 +47,5 @@ FILE fqName: fileName:/function.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.C) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.C BLOCK_BODY - CALL 'public final fun foo (: .C): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .bar.' type=.C origin=null + CALL 'public final fun foo (_context_receiver_0: .C): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .bar.' type=.C origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.kt b/compiler/testData/ir/irText/declarations/contextReceivers/function.kt index b6ed9116aed..c47f2ff99ee 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/function.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class C { diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/function.kt.txt index a24bd398adb..a2b63fa51c5 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/function.kt.txt @@ -11,13 +11,13 @@ class C { } -fun foo(: C) { - .() /*~> Unit */ +fun foo(_context_receiver_0: C) { + _context_receiver_0.() /*~> Unit */ } fun bar(c: C) { with(receiver = c, block = local fun C.() { - foo( = $this$with) + foo(_context_receiver_0 = $this$with) } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/function.txt b/compiler/testData/ir/irText/declarations/contextReceivers/function.txt deleted file mode 100644 index b3d2a22133a..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/function.txt +++ /dev/null @@ -1,50 +0,0 @@ -FILE fqName: fileName:/function.kt - CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C - CONSTRUCTOR visibility:public <> () returnType:.C [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:c visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final] - EXPRESSION_BODY - CONST Int type=kotlin.Int value=42 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int - correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.C - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .C' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .C declared in .C.' type=.C origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:foo visibility:public modality:FINAL <> (:.C) returnType:kotlin.Unit - VALUE_PARAMETER name: index:0 type:.C - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .foo' type=.C origin=null - FUN name:bar visibility:public modality:FINAL <> (c:.C) returnType:kotlin.Unit - VALUE_PARAMETER name:c index:0 type:.C - BLOCK_BODY - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null - : .C - : kotlin.Unit - receiver: GET_VAR 'c: .C declared in .bar' type=.C origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.C, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.C) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name:$this$with type:.C - BLOCK_BODY - CALL 'public final fun foo (: .C): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .bar.' type=.C origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.ir.txt index fb890dfe9d7..62a241aa1da 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.ir.txt @@ -78,52 +78,52 @@ FILE fqName: fileName:/functionalType.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f1 visibility:public modality:FINAL <> ($receiver:.R, :.C, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>) returnType:kotlin.Unit + FUN name:f1 visibility:public modality:FINAL <> ($receiver:.R, _context_receiver_0:.C, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER name:g index:1 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> BLOCK_BODY CALL 'public abstract fun invoke (p1: P1 of kotlin.Function3, p2: P2 of kotlin.Function3, p3: P3 of kotlin.Function3): R of kotlin.Function3 [operator] declared in kotlin.Function3' type=kotlin.Unit origin=INVOKE $this: GET_VAR 'g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> declared in .f1' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .C declared in .f1' type=.C origin=null + p1: GET_VAR '_context_receiver_0: .C declared in .f1' type=.C origin=null p2: GET_VAR ': .R declared in .f1' type=.R origin=null p3: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Param' type=.Param origin=null - FUN name:f2 visibility:public modality:FINAL <> (:.C, g:@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>) returnType:kotlin.Unit + FUN name:f2 visibility:public modality:FINAL <> (_context_receiver_0:.C, g:@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER name:g index:1 type:@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> BLOCK_BODY CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=kotlin.Unit origin=INVOKE $this: GET_VAR 'g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> declared in .f2' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .C declared in .f2' type=.C origin=null + p1: GET_VAR '_context_receiver_0: .C declared in .f2' type=.C origin=null p2: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Param' type=.Param origin=null - FUN name:f3 visibility:public modality:FINAL <> ($receiver:.R, :.C, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>) returnType:kotlin.Unit + FUN name:f3 visibility:public modality:FINAL <> ($receiver:.R, _context_receiver_0:.C, g:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER name:g index:1 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> BLOCK_BODY CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=kotlin.Unit origin=INVOKE $this: GET_VAR 'g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> declared in .f3' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .C declared in .f3' type=.C origin=null + p1: GET_VAR '_context_receiver_0: .C declared in .f3' type=.C origin=null p2: GET_VAR ': .R declared in .f3' type=.R origin=null - FUN name:f4 visibility:public modality:FINAL <> (:.C, g:@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>) returnType:kotlin.Unit + FUN name:f4 visibility:public modality:FINAL <> (_context_receiver_0:.C, g:@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER name:g index:1 type:@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> BLOCK_BODY CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE $this: GET_VAR 'g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> declared in .f4' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR ': .C declared in .f4' type=.C origin=null + p1: GET_VAR '_context_receiver_0: .C declared in .f4' type=.C origin=null FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:lf1 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> [val] FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, :.C, :.Param) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, _context_receiver_0:.C, :.Param) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name:$this$null type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER UNDERSCORE_PARAMETER name: index:1 type:.Param BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit @@ -131,39 +131,39 @@ FILE fqName: fileName:/functionalType.kt $this: GET_VAR '$this$null: .R declared in .test.' type=.R origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .test.' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .test.' type=.C origin=null VAR name:lf2 type:@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> [val] FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.C, :.Param) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (_context_receiver_0:.C, :.Param) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER UNDERSCORE_PARAMETER name: index:1 type:.Param BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .test.' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .test.' type=.C origin=null VAR name:lf3 type:@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> [val] FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, :.C) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, _context_receiver_0:.C) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name:$this$null type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .R' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '$this$null: .R declared in .test.' type=.R origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .test.' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .test.' type=.C origin=null VAR name:lf4 type:@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> [val] FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.C) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (_context_receiver_0:.C) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .test.' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .test.' type=.C origin=null CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null : .C : kotlin.Unit @@ -180,18 +180,18 @@ FILE fqName: fileName:/functionalType.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.R BLOCK_BODY - CALL 'public final fun f1 (: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun f1 (_context_receiver_0: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR '$this$with: .R declared in .test..' type=.R origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: GET_VAR 'val lf1: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> [val] declared in .test' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> origin=null - CALL 'public final fun f1 (: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun f1 (_context_receiver_0: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR '$this$with: .R declared in .test..' type=.R origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<.C, .R, .Param, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, :.C, :.Param) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, _context_receiver_0:.C, :.Param) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name:$this$f1 type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER UNDERSCORE_PARAMETER name: index:1 type:.Param BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit @@ -200,32 +200,32 @@ FILE fqName: fileName:/functionalType.kt TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null - CALL 'public final fun f2 (: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + CALL 'public final fun f2 (_context_receiver_0: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: GET_VAR 'val lf2: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> [val] declared in .test' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> origin=null - CALL 'public final fun f2 (: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + CALL 'public final fun f2 (_context_receiver_0: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .Param, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.C, :.Param) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (_context_receiver_0:.C, :.Param) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C VALUE_PARAMETER UNDERSCORE_PARAMETER name: index:1 type:.Param BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null - CALL 'public final fun f3 (: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun f3 (_context_receiver_0: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR '$this$with: .R declared in .test..' type=.R origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: GET_VAR 'val lf3: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> [val] declared in .test' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> origin=null - CALL 'public final fun f3 (: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun f3 (_context_receiver_0: .C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null $receiver: GET_VAR '$this$with: .R declared in .test..' type=.R origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<.C, .R, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, :.C) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.R, _context_receiver_0:.C) returnType:kotlin.Unit contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name:$this$f3 type:.R - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .R' type=kotlin.Int origin=GET_PROPERTY @@ -233,15 +233,15 @@ FILE fqName: fileName:/functionalType.kt TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null - CALL 'public final fun f4 (: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + CALL 'public final fun f4 (_context_receiver_0: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: GET_VAR 'val lf4: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> [val] declared in .test' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> origin=null - CALL 'public final fun f4 (: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .C declared in .test.' type=.C origin=null + CALL 'public final fun f4 (_context_receiver_0: .C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .C declared in .test.' type=.C origin=null g: FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.C) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (_context_receiver_0:.C) returnType:kotlin.Unit contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.kt.txt index f05128f3fee..4e89c9f489f 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/functionalType.kt.txt @@ -33,62 +33,62 @@ class R { } -fun R.f1(: C, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3) { - g.invoke(p1 = , p2 = , p3 = Param()) +fun R.f1(_context_receiver_0: C, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3) { + g.invoke(p1 = _context_receiver_0, p2 = , p3 = Param()) } -fun f2(: C, g: @ContextFunctionTypeParams(count = 1) Function2) { - g.invoke(p1 = , p2 = Param()) +fun f2(_context_receiver_0: C, g: @ContextFunctionTypeParams(count = 1) Function2) { + g.invoke(p1 = _context_receiver_0, p2 = Param()) } -fun R.f3(: C, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2) { - g.invoke(p1 = , p2 = ) +fun R.f3(_context_receiver_0: C, g: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2) { + g.invoke(p1 = _context_receiver_0, p2 = ) } -fun f4(: C, g: @ContextFunctionTypeParams(count = 1) Function1) { - g.invoke(p1 = ) +fun f4(_context_receiver_0: C, g: @ContextFunctionTypeParams(count = 1) Function1) { + g.invoke(p1 = _context_receiver_0) } fun test() { - val lf1: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3 = local fun R.(: C, : Param) { + val lf1: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3 = local fun R.(_context_receiver_0: C, : Param) { $this$null.() /*~> Unit */ - .() /*~> Unit */ + _context_receiver_0.() /*~> Unit */ } - val lf2: @ContextFunctionTypeParams(count = 1) Function2 = local fun (: C, : Param) { - .() /*~> Unit */ + val lf2: @ContextFunctionTypeParams(count = 1) Function2 = local fun (_context_receiver_0: C, : Param) { + _context_receiver_0.() /*~> Unit */ } - val lf3: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2 = local fun R.(: C) { + val lf3: @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2 = local fun R.(_context_receiver_0: C) { $this$null.() /*~> Unit */ - .() /*~> Unit */ + _context_receiver_0.() /*~> Unit */ } - val lf4: @ContextFunctionTypeParams(count = 1) Function1 = local fun (: C) { - .() /*~> Unit */ + val lf4: @ContextFunctionTypeParams(count = 1) Function1 = local fun (_context_receiver_0: C) { + _context_receiver_0.() /*~> Unit */ } with(receiver = C(), block = local fun C.() { with(receiver = R(), block = local fun R.() { - $this$with.f1( = $this$with, g = lf1) - $this$with.f1( = $this$with, g = local fun R.(: C, : Param) { + $this$with.f1(_context_receiver_0 = $this$with, g = lf1) + $this$with.f1(_context_receiver_0 = $this$with, g = local fun R.(_context_receiver_0: C, : Param) { $this$f1.() /*~> Unit */ $this$with.() /*~> Unit */ } ) - f2( = $this$with, g = lf2) - f2( = $this$with, g = local fun (: C, : Param) { + f2(_context_receiver_0 = $this$with, g = lf2) + f2(_context_receiver_0 = $this$with, g = local fun (_context_receiver_0: C, : Param) { $this$with.() /*~> Unit */ } ) - $this$with.f3( = $this$with, g = lf3) - $this$with.f3( = $this$with, g = local fun R.(: C) { + $this$with.f3(_context_receiver_0 = $this$with, g = lf3) + $this$with.f3(_context_receiver_0 = $this$with, g = local fun R.(_context_receiver_0: C) { $this$f3.() /*~> Unit */ $this$with.() /*~> Unit */ } ) - f4( = $this$with, g = lf4) - f4( = $this$with, g = local fun (: C) { + f4(_context_receiver_0 = $this$with, g = lf4) + f4(_context_receiver_0 = $this$with, g = local fun (_context_receiver_0: C) { $this$with.() /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.ir.txt index a81d399a9a3..fde292de35a 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.ir.txt @@ -257,16 +257,16 @@ FILE fqName: fileName:/iteratorOperator.kt overridden: public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Iterator $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:iterator visibility:public modality:FINAL <> ($receiver:.Counter, :.CounterConfig) returnType:.CounterIterator [operator] + FUN name:iterator visibility:public modality:FINAL <> ($receiver:.Counter, _context_receiver_0:.CounterConfig) returnType:.CounterIterator [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Counter - VALUE_PARAMETER name: index:0 type:.CounterConfig + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.CounterConfig BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun iterator (: .CounterConfig): .CounterIterator [operator] declared in ' + RETURN type=kotlin.Nothing from='public final fun iterator (_context_receiver_0: .CounterConfig): .CounterIterator [operator] declared in ' CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=.CounterIterator origin=null : .CounterConfig : .CounterIterator - receiver: GET_VAR ': .CounterConfig declared in .iterator' type=.CounterConfig origin=null + receiver: GET_VAR '_context_receiver_0: .CounterConfig declared in .iterator' type=.CounterConfig origin=null block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.CounterConfig, .CounterIterator> origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.CounterConfig) returnType:.CounterIterator $receiver: VALUE_PARAMETER name:$this$with type:.CounterConfig @@ -289,9 +289,9 @@ FILE fqName: fileName:/iteratorOperator.kt BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR FOR_LOOP_ITERATOR name:tmp_4 type:.CounterIterator [val] - CALL 'public final fun iterator (: .CounterConfig): .CounterIterator [operator] declared in ' type=.CounterIterator origin=FOR_LOOP_ITERATOR + CALL 'public final fun iterator (_context_receiver_0: .CounterConfig): .CounterIterator [operator] declared in ' type=.CounterIterator origin=FOR_LOOP_ITERATOR $receiver: CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Counter' type=.Counter origin=null - : GET_VAR '$this$with: .CounterConfig declared in .box.' type=.CounterConfig origin=null + _context_receiver_0: GET_VAR '$this$with: .CounterConfig declared in .box.' type=.CounterConfig origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public open fun hasNext (): kotlin.Boolean [operator] declared in .CounterIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_4: .CounterIterator [val] declared in .box.' type=.CounterIterator origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt.txt index 2100410127f..b501af60d3f 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt.txt @@ -115,8 +115,8 @@ class CounterIterator : Iterator { } -operator fun Counter.iterator(: CounterConfig): CounterIterator { - return with(receiver = , block = local fun CounterConfig.(): CounterIterator { +operator fun Counter.iterator(_context_receiver_0: CounterConfig): CounterIterator { + return with(receiver = _context_receiver_0, block = local fun CounterConfig.(): CounterIterator { return CounterIterator( = $this$with, counter = ) } ) @@ -126,7 +126,7 @@ fun box(): String { var result: Int = 0 with(receiver = CounterConfig(), block = local fun CounterConfig.() { { // BLOCK - val tmp0_iterator: CounterIterator = Counter().iterator( = $this$with) + val tmp0_iterator: CounterIterator = Counter().iterator(_context_receiver_0 = $this$with) while (tmp0_iterator.hasNext()) { // BLOCK val i: Int = tmp0_iterator.next() { // BLOCK diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/lazy.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/lazy.ir.txt index a9e08379e63..21f545065a3 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/lazy.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/lazy.ir.txt @@ -15,22 +15,22 @@ FILE fqName: fileName:/lazy.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:test1 visibility:public modality:FINAL <> (:.Lazy, :.Lazy) returnType:kotlin.Unit + FUN name:test1 visibility:public modality:FINAL <> (_context_receiver_0:.Lazy, _context_receiver_1:.Lazy) returnType:kotlin.Unit contextReceiverParametersCount: 2 - VALUE_PARAMETER name: index:0 type:.Lazy - VALUE_PARAMETER name: index:1 type:.Lazy + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Lazy + VALUE_PARAMETER name:_context_receiver_1 index:1 type:.Lazy BLOCK_BODY - FUN name:test2 visibility:public modality:FINAL ($receiver:.Lazy, :.Lazy.test2>) returnType:kotlin.Unit + FUN name:test2 visibility:public modality:FINAL ($receiver:.Lazy, _context_receiver_0:.Lazy.test2>) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Lazy - VALUE_PARAMETER name: index:0 type:.Lazy.test2> + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Lazy.test2> BLOCK_BODY - FUN name:test3 visibility:public modality:FINAL ($receiver:.Lazy, :.Lazy<.Lazy.test3>>) returnType:kotlin.Unit + FUN name:test3 visibility:public modality:FINAL ($receiver:.Lazy, _context_receiver_0:.Lazy<.Lazy.test3>>) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Lazy - VALUE_PARAMETER name: index:0 type:.Lazy<.Lazy.test3>> + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Lazy<.Lazy.test3>> BLOCK_BODY FUN name:f visibility:public modality:FINAL (lazy1:.Lazy, lazy2:.Lazy, lazyT:.Lazy.f>, lazyLazyT:.Lazy<.Lazy.f>>) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false @@ -55,13 +55,13 @@ FILE fqName: fileName:/lazy.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Lazy) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.Lazy BLOCK_BODY - CALL 'public final fun test1 (: .Lazy, : .Lazy): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - CALL 'public final fun test2 (: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun test1 (_context_receiver_0: .Lazy, _context_receiver_1: .Lazy): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null + _context_receiver_1: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + CALL 'public final fun test2 (_context_receiver_0: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : kotlin.CharSequence $receiver: GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null : .Lazy : kotlin.Unit @@ -78,13 +78,13 @@ FILE fqName: fileName:/lazy.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Lazy) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.Lazy BLOCK_BODY - CALL 'public final fun test1 (: .Lazy, : .Lazy): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null - CALL 'public final fun test2 (: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun test1 (_context_receiver_0: .Lazy, _context_receiver_1: .Lazy): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + _context_receiver_1: GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null + CALL 'public final fun test2 (_context_receiver_0: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : kotlin.Int $receiver: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null : .Lazy.f> : kotlin.Unit @@ -101,10 +101,10 @@ FILE fqName: fileName:/lazy.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Lazy) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.Lazy BLOCK_BODY - CALL 'public final fun test2 (: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun test2 (_context_receiver_0: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : kotlin.Int $receiver: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null : .Lazy<.Lazy.f>> : kotlin.Unit @@ -121,14 +121,14 @@ FILE fqName: fileName:/lazy.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Lazy) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.Lazy BLOCK_BODY - CALL 'public final fun test2 (: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun test2 (_context_receiver_0: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : kotlin.Int $receiver: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - CALL 'public final fun test3 (: .Lazy<.Lazy.test3>>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null + CALL 'public final fun test3 (_context_receiver_0: .Lazy<.Lazy.test3>>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : T of .f $receiver: GET_VAR '$this$with: .Lazy declared in .f..' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f.' type=.Lazy<.Lazy.f>> origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f.' type=.Lazy<.Lazy.f>> origin=null CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null : .Lazy : kotlin.Unit @@ -145,11 +145,11 @@ FILE fqName: fileName:/lazy.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Lazy<.Lazy.f>>) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:.Lazy<.Lazy.f>> BLOCK_BODY - CALL 'public final fun test2 (: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun test2 (_context_receiver_0: .Lazy.test2>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : .Lazy.f> $receiver: GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f..' type=.Lazy<.Lazy.f>> origin=null - CALL 'public final fun test3 (: .Lazy<.Lazy.test3>>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f..' type=.Lazy<.Lazy.f>> origin=null + CALL 'public final fun test3 (_context_receiver_0: .Lazy<.Lazy.test3>>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : T of .f $receiver: GET_VAR '$this$with: .Lazy declared in .f.' type=.Lazy origin=null - : GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f..' type=.Lazy<.Lazy.f>> origin=null + _context_receiver_0: GET_VAR '$this$with: .Lazy<.Lazy.f>> declared in .f..' type=.Lazy<.Lazy.f>> origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt.txt index 762b8612d01..bb3349a75e2 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt.txt @@ -2,51 +2,51 @@ interface Lazy { } -fun test1(: Lazy, : Lazy) { +fun test1(_context_receiver_0: Lazy, _context_receiver_1: Lazy) { } -fun Lazy.test2(: Lazy) { +fun Lazy.test2(_context_receiver_0: Lazy) { } -fun Lazy.test3(: Lazy>) { +fun Lazy.test3(_context_receiver_0: Lazy>) { } fun f(lazy1: Lazy, lazy2: Lazy, lazyT: Lazy, lazyLazyT: Lazy>) { with, Unit>(receiver = lazy1, block = local fun Lazy.() { with, Unit>(receiver = lazy2, block = local fun Lazy.() { - test1( = $this$with, = $this$with) - $this$with.test2( = $this$with) + test1(_context_receiver_0 = $this$with, _context_receiver_1 = $this$with) + $this$with.test2(_context_receiver_0 = $this$with) } ) } ) with, Unit>(receiver = lazy2, block = local fun Lazy.() { with, Unit>(receiver = lazy1, block = local fun Lazy.() { - test1( = $this$with, = $this$with) - $this$with.test2( = $this$with) + test1(_context_receiver_0 = $this$with, _context_receiver_1 = $this$with) + $this$with.test2(_context_receiver_0 = $this$with) } ) } ) with, Unit>(receiver = lazyT, block = local fun Lazy.() { with, Unit>(receiver = lazy1, block = local fun Lazy.() { - $this$with.test2( = $this$with) + $this$with.test2(_context_receiver_0 = $this$with) } ) } ) with>, Unit>(receiver = lazyLazyT, block = local fun Lazy>.() { with, Unit>(receiver = lazy1, block = local fun Lazy.() { - $this$with.test2( = $this$with) - $this$with.test3( = $this$with) + $this$with.test2(_context_receiver_0 = $this$with) + $this$with.test3(_context_receiver_0 = $this$with) } ) } ) with, Unit>(receiver = lazy1, block = local fun Lazy.() { with>, Unit>(receiver = lazyLazyT, block = local fun Lazy>.() { - $this$with.test2>( = $this$with) - $this$with.test3( = $this$with) + $this$with.test2>(_context_receiver_0 = $this$with) + $this$with.test3(_context_receiver_0 = $this$with) } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.ir.txt deleted file mode 100644 index d3a5dc1ce19..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.ir.txt +++ /dev/null @@ -1,45 +0,0 @@ -FILE fqName: fileName:/overloadPriority.kt - CLASS CLASS name:Context modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Context - CONSTRUCTOR visibility:public <> () returnType:.Context [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Context modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL <> (_context_receiver_0:.Context) returnType:kotlin.String - contextReceiverParametersCount: 1 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun f (_context_receiver_0: .Context): kotlin.String declared in ' - CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null - FUN name:f visibility:public modality:FINAL <> () returnType:kotlin.Any - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun f (): kotlin.Any declared in ' - CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null - FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Int origin=null - : .Context - : kotlin.Int - receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Context' type=.Context origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.Context, kotlin.Int> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.Context) returnType:kotlin.Int - $receiver: VALUE_PARAMETER name:$this$with type:.Context - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test' - CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: CALL 'public final fun f (_context_receiver_0: .Context): kotlin.String declared in ' type=kotlin.String origin=null - _context_receiver_0: GET_VAR '$this$with: .Context declared in .test.' type=.Context origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.kt.txt deleted file mode 100644 index 72c6f771651..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.fir.kt.txt +++ /dev/null @@ -1,23 +0,0 @@ -class Context { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - -} - -fun f(_context_receiver_0: Context): String { - return TODO() -} - -fun f(): Any { - return TODO() -} - -fun test() { - with(receiver = Context(), block = local fun Context.(): Int { - return f(_context_receiver_0 = $this$with).() - } -) /*~> Unit */ -} diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.ir.txt index 8d0addc4503..d3a5dc1ce19 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.ir.txt @@ -18,11 +18,11 @@ FILE fqName: fileName:/overloadPriority.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL <> (:.Context) returnType:kotlin.String + FUN name:f visibility:public modality:FINAL <> (_context_receiver_0:.Context) returnType:kotlin.String contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.Context + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.Context BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun f (: .Context): kotlin.String declared in ' + RETURN type=kotlin.Nothing from='public final fun f (_context_receiver_0: .Context): kotlin.String declared in ' CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null FUN name:f visibility:public modality:FINAL <> () returnType:kotlin.Any BLOCK_BODY @@ -41,5 +41,5 @@ FILE fqName: fileName:/overloadPriority.kt BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test' CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: CALL 'public final fun f (: .Context): kotlin.String declared in ' type=kotlin.String origin=null - : GET_VAR '$this$with: .Context declared in .test.' type=.Context origin=null + $this: CALL 'public final fun f (_context_receiver_0: .Context): kotlin.String declared in ' type=kotlin.String origin=null + _context_receiver_0: GET_VAR '$this$with: .Context declared in .test.' type=.Context origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt index 7bbeeaa485a..9dd98b72e55 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class Context diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt.txt index ce4cec63a55..72c6f771651 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt.txt @@ -7,7 +7,7 @@ class Context { } -fun f(: Context): String { +fun f(_context_receiver_0: Context): String { return TODO() } @@ -17,7 +17,7 @@ fun f(): Any { fun test() { with(receiver = Context(), block = local fun Context.(): Int { - return f( = $this$with).() + return f(_context_receiver_0 = $this$with).() } ) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.ir.txt deleted file mode 100644 index 00fb1e551b4..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.ir.txt +++ /dev/null @@ -1,32 +0,0 @@ -FILE fqName: fileName:/overloading.kt - FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:kotlin.Int, _context_receiver_1:kotlin.String) returnType:kotlin.Int - contextReceiverParametersCount: 2 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int - VALUE_PARAMETER name:_context_receiver_1 index:1 type:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun foo (_context_receiver_0: kotlin.Int, _context_receiver_1: kotlin.String): kotlin.Int declared in ' - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: GET_VAR '_context_receiver_0: kotlin.Int declared in .foo' type=kotlin.Int origin=null - other: CONST Int type=kotlin.Int value=42 - FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:kotlin.Int) returnType:kotlin.Int - contextReceiverParametersCount: 1 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun foo (_context_receiver_0: kotlin.Int): kotlin.Int declared in ' - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: GET_VAR '_context_receiver_0: kotlin.Int declared in .foo' type=kotlin.Int origin=null - other: CONST Int type=kotlin.Int value=42 - FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Int origin=null - : kotlin.Int - : kotlin.Int - receiver: CONST Int type=kotlin.Int value=42 - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Int - $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test' - CALL 'public final fun foo (_context_receiver_0: kotlin.Int): kotlin.Int declared in ' type=kotlin.Int origin=null - _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.kt.txt deleted file mode 100644 index 13fedc8cb2a..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.fir.kt.txt +++ /dev/null @@ -1,14 +0,0 @@ -fun foo(_context_receiver_0: Int, _context_receiver_1: String): Int { - return _context_receiver_0.plus(other = 42) -} - -fun foo(_context_receiver_0: Int): Int { - return _context_receiver_0.plus(other = 42) -} - -fun test() { - with(receiver = 42, block = local fun Int.(): Int { - return foo(_context_receiver_0 = $this$with) - } -) /*~> Unit */ -} diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.ir.txt index 5d1e48078b9..00fb1e551b4 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.ir.txt @@ -1,20 +1,20 @@ FILE fqName: fileName:/overloading.kt - FUN name:foo visibility:public modality:FINAL <> (:kotlin.Int, :kotlin.String) returnType:kotlin.Int + FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:kotlin.Int, _context_receiver_1:kotlin.String) returnType:kotlin.Int contextReceiverParametersCount: 2 - VALUE_PARAMETER name: index:0 type:kotlin.Int - VALUE_PARAMETER name: index:1 type:kotlin.String + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_1 index:1 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun foo (: kotlin.Int, : kotlin.String): kotlin.Int declared in ' + RETURN type=kotlin.Nothing from='public final fun foo (_context_receiver_0: kotlin.Int, _context_receiver_1: kotlin.String): kotlin.Int declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: GET_VAR ': kotlin.Int declared in .foo' type=kotlin.Int origin=null + $this: GET_VAR '_context_receiver_0: kotlin.Int declared in .foo' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=42 - FUN name:foo visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Int + FUN name:foo visibility:public modality:FINAL <> (_context_receiver_0:kotlin.Int) returnType:kotlin.Int contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun foo (: kotlin.Int): kotlin.Int declared in ' + RETURN type=kotlin.Nothing from='public final fun foo (_context_receiver_0: kotlin.Int): kotlin.Int declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: GET_VAR ': kotlin.Int declared in .foo' type=kotlin.Int origin=null + $this: GET_VAR '_context_receiver_0: kotlin.Int declared in .foo' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=42 FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY @@ -28,5 +28,5 @@ FILE fqName: fileName:/overloading.kt $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test' - CALL 'public final fun foo (: kotlin.Int): kotlin.Int declared in ' type=kotlin.Int origin=null - : GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null + CALL 'public final fun foo (_context_receiver_0: kotlin.Int): kotlin.Int declared in ' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt index d4eb6085eb1..e63fdc58cc3 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers context(Int, String) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt.txt index 0ded1856899..13fedc8cb2a 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/overloading.kt.txt @@ -1,14 +1,14 @@ -fun foo(: Int, : String): Int { - return .plus(other = 42) +fun foo(_context_receiver_0: Int, _context_receiver_1: String): Int { + return _context_receiver_0.plus(other = 42) } -fun foo(: Int): Int { - return .plus(other = 42) +fun foo(_context_receiver_0: Int): Int { + return _context_receiver_0.plus(other = 42) } fun test() { with(receiver = 42, block = local fun Int.(): Int { - return foo( = $this$with) + return foo(_context_receiver_0 = $this$with) } ) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.ir.txt index cf726e3140a..ecb604831d1 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.ir.txt @@ -41,10 +41,10 @@ FILE fqName: fileName:/passingLambdaToContextualParam.kt RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CALL 'public final fun contextual (f: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.String>): kotlin.String declared in ' type=kotlin.String origin=null f: FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<.C, kotlin.String> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.C) returnType:kotlin.String + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (_context_receiver_0:.C) returnType:kotlin.String contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.C + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.C BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (: .C): kotlin.String declared in .box' + RETURN type=kotlin.Nothing from='local final fun (_context_receiver_0: .C): kotlin.String declared in .box' CALL 'public final fun (): kotlin.String declared in .C' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .box.' type=.C origin=null + $this: GET_VAR '_context_receiver_0: .C declared in .box.' type=.C origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.kt.txt index 0f2a9be31dc..0afbe1fcae0 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/passingLambdaToContextualParam.kt.txt @@ -16,8 +16,8 @@ fun contextual(f: @ContextFunctionTypeParams(count = 1) Function1): S } fun box(): String { - return contextual(f = local fun (: C): String { - return .() + return contextual(f = local fun (_context_receiver_0: C): String { + return _context_receiver_0.() } ) } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.ir.txt deleted file mode 100644 index 56bf88c0e3e..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.ir.txt +++ /dev/null @@ -1,62 +0,0 @@ -FILE fqName: fileName:/plusMatrix.kt - CLASS INTERFACE name:NumberOperations modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.NumberOperations - FUN name:plus visibility:public modality:ABSTRACT <> ($this:.NumberOperations, $receiver:kotlin.Number, other:kotlin.Number) returnType:kotlin.Number - $this: VALUE_PARAMETER name: type:.NumberOperations - $receiver: VALUE_PARAMETER name: type:kotlin.Number - VALUE_PARAMETER name:other index:0 type:kotlin.Number - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:Matrix modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Matrix - CONSTRUCTOR visibility:public <> () returnType:.Matrix [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Matrix modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:plus visibility:public modality:FINAL <> ($receiver:.Matrix, _context_receiver_0:.NumberOperations, other:.Matrix) returnType:.Matrix - contextReceiverParametersCount: 1 - $receiver: VALUE_PARAMETER name: type:.Matrix - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.NumberOperations - VALUE_PARAMETER name:other index:1 type:.Matrix - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' - CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null - FUN name:plusMatrix visibility:public modality:FINAL <> ($receiver:.NumberOperations, m1:.Matrix, m2:.Matrix) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:.NumberOperations - VALUE_PARAMETER name:m1 index:0 type:.Matrix - VALUE_PARAMETER name:m2 index:1 type:.Matrix - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null - $receiver: GET_VAR 'm1: .Matrix declared in .plusMatrix' type=.Matrix origin=null - _context_receiver_0: GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null - other: GET_VAR 'm2: .Matrix declared in .plusMatrix' type=.Matrix origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null - $receiver: GET_VAR 'm2: .Matrix declared in .plusMatrix' type=.Matrix origin=null - _context_receiver_0: GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null - other: GET_VAR 'm1: .Matrix declared in .plusMatrix' type=.Matrix origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.kt.txt deleted file mode 100644 index 0659c7954d3..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.fir.kt.txt +++ /dev/null @@ -1,22 +0,0 @@ -interface NumberOperations { - abstract fun Number.plus(other: Number): Number - -} - -class Matrix { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - -} - -fun Matrix.plus(_context_receiver_0: NumberOperations, other: Matrix): Matrix { - return TODO() -} - -fun NumberOperations.plusMatrix(m1: Matrix, m2: Matrix) { - m1.plus(_context_receiver_0 = , other = m2) /*~> Unit */ - m2.plus(_context_receiver_0 = , other = m1) /*~> Unit */ -} diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.ir.txt index 03e87d73902..56bf88c0e3e 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.ir.txt @@ -37,13 +37,13 @@ FILE fqName: fileName:/plusMatrix.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:plus visibility:public modality:FINAL <> ($receiver:.Matrix, :.NumberOperations, other:.Matrix) returnType:.Matrix + FUN name:plus visibility:public modality:FINAL <> ($receiver:.Matrix, _context_receiver_0:.NumberOperations, other:.Matrix) returnType:.Matrix contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Matrix - VALUE_PARAMETER name: index:0 type:.NumberOperations + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.NumberOperations VALUE_PARAMETER name:other index:1 type:.Matrix BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun plus (: .NumberOperations, other: .Matrix): .Matrix declared in ' + RETURN type=kotlin.Nothing from='public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null FUN name:plusMatrix visibility:public modality:FINAL <> ($receiver:.NumberOperations, m1:.Matrix, m2:.Matrix) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.NumberOperations @@ -51,12 +51,12 @@ FILE fqName: fileName:/plusMatrix.kt VALUE_PARAMETER name:m2 index:1 type:.Matrix BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun plus (: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null + CALL 'public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null $receiver: GET_VAR 'm1: .Matrix declared in .plusMatrix' type=.Matrix origin=null - : GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null + _context_receiver_0: GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null other: GET_VAR 'm2: .Matrix declared in .plusMatrix' type=.Matrix origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun plus (: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null + CALL 'public final fun plus (_context_receiver_0: .NumberOperations, other: .Matrix): .Matrix declared in ' type=.Matrix origin=null $receiver: GET_VAR 'm2: .Matrix declared in .plusMatrix' type=.Matrix origin=null - : GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null + _context_receiver_0: GET_VAR ': .NumberOperations declared in .plusMatrix' type=.NumberOperations origin=null other: GET_VAR 'm1: .Matrix declared in .plusMatrix' type=.Matrix origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt index dca4c87f458..a38ef0300e0 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt.txt index 48abea1a7b2..0659c7954d3 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/plusMatrix.kt.txt @@ -12,11 +12,11 @@ class Matrix { } -fun Matrix.plus(: NumberOperations, other: Matrix): Matrix { +fun Matrix.plus(_context_receiver_0: NumberOperations, other: Matrix): Matrix { return TODO() } fun NumberOperations.plusMatrix(m1: Matrix, m2: Matrix) { - m1.plus( = , other = m2) /*~> Unit */ - m2.plus( = , other = m1) /*~> Unit */ + m1.plus(_context_receiver_0 = , other = m2) /*~> Unit */ + m2.plus(_context_receiver_0 = , other = m1) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.ir.txt deleted file mode 100644 index e63f68564e6..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.ir.txt +++ /dev/null @@ -1,48 +0,0 @@ -FILE fqName: fileName:/property.kt - CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A - FUN name:a visibility:public modality:ABSTRACT <> ($this:.A) returnType:kotlin.Int - $this: VALUE_PARAMETER name: type:.A - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B - FUN name:b visibility:public modality:ABSTRACT <> ($this:.B) returnType:kotlin.Int - $this: VALUE_PARAMETER name: type:.B - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - PROPERTY name:c visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> (_context_receiver_0:.A, _context_receiver_1:.B) returnType:kotlin.Int - correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val] - contextReceiverParametersCount: 2 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A - VALUE_PARAMETER name:_context_receiver_1 index:1 type:.B - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: .A, _context_receiver_1: .B): kotlin.Int declared in ' - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS - $this: CALL 'public abstract fun a (): kotlin.Int declared in .A' type=kotlin.Int origin=null - $this: GET_VAR '_context_receiver_0: .A declared in .' type=.A origin=null - other: CALL 'public abstract fun b (): kotlin.Int declared in .B' type=kotlin.Int origin=null - $this: GET_VAR '_context_receiver_1: .B declared in .' type=.B origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.kt.txt deleted file mode 100644 index cef4e06e00d..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/property.fir.kt.txt +++ /dev/null @@ -1,14 +0,0 @@ -interface A { - abstract fun a(): Int - -} - -interface B { - abstract fun b(): Int - -} - -val c: Int - get(_context_receiver_0: A, _context_receiver_1: B): Int { - return _context_receiver_0.a().plus(other = _context_receiver_1.b()) - } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/property.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/property.ir.txt index 93af32c53ac..e63f68564e6 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/property.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/property.ir.txt @@ -34,15 +34,15 @@ FILE fqName: fileName:/property.kt public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any PROPERTY name:c visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> (:.A, :.B) returnType:kotlin.Int + FUN name: visibility:public modality:FINAL <> (_context_receiver_0:.A, _context_receiver_1:.B) returnType:kotlin.Int correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val] contextReceiverParametersCount: 2 - VALUE_PARAMETER name: index:0 type:.A - VALUE_PARAMETER name: index:1 type:.B + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A + VALUE_PARAMETER name:_context_receiver_1 index:1 type:.B BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (: .A, : .B): kotlin.Int declared in ' + RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: .A, _context_receiver_1: .B): kotlin.Int declared in ' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public abstract fun a (): kotlin.Int declared in .A' type=kotlin.Int origin=null - $this: GET_VAR ': .A declared in .' type=.A origin=null + $this: GET_VAR '_context_receiver_0: .A declared in .' type=.A origin=null other: CALL 'public abstract fun b (): kotlin.Int declared in .B' type=kotlin.Int origin=null - $this: GET_VAR ': .B declared in .' type=.B origin=null + $this: GET_VAR '_context_receiver_1: .B declared in .' type=.B origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/property.kt b/compiler/testData/ir/irText/declarations/contextReceivers/property.kt index cfebc731f0a..2318f9dd52c 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/property.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/property.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers interface A { diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/property.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/property.kt.txt index 61e590f02c5..cef4e06e00d 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/property.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/property.kt.txt @@ -9,7 +9,6 @@ interface B { } val c: Int - get(: A, : B): Int { - return .a().plus(other = .b()) + get(_context_receiver_0: A, _context_receiver_1: B): Int { + return _context_receiver_0.a().plus(other = _context_receiver_1.b()) } - diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.ir.txt deleted file mode 100644 index 082b9a55bca..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.ir.txt +++ /dev/null @@ -1,143 +0,0 @@ -FILE fqName: fileName:/thisWithCustomLabel.kt - CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.A> - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false - CONSTRUCTOR visibility:public <> (a:T of .A) returnType:.A.A> [primary] - VALUE_PARAMETER name:a index:0 type:T of .A - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:a visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:a type:T of .A visibility:private [final] - EXPRESSION_BODY - GET_VAR 'a: T of .A declared in .A.' type=T of .A origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A.A>) returnType:T of .A - correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.A.A> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): T of .A declared in .A' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:T of .A visibility:private [final]' type=T of .A origin=null - receiver: GET_VAR ': .A.A> declared in .A.' type=.A.A> origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:B modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B - CONSTRUCTOR visibility:public <> (b:kotlin.Any) returnType:.B [primary] - VALUE_PARAMETER name:b index:0 type:kotlin.Any - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:b visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:b type:kotlin.Any visibility:private [final] - EXPRESSION_BODY - GET_VAR 'b: kotlin.Any declared in .B.' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.B) returnType:kotlin.Any - correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.B - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in .B' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - receiver: GET_VAR ': .B declared in .B.' type=.B origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C - CONSTRUCTOR visibility:public <> (c:kotlin.Any) returnType:.C [primary] - VALUE_PARAMETER name:c index:0 type:kotlin.Any - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:c visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Any visibility:private [final] - EXPRESSION_BODY - GET_VAR 'c: kotlin.Any declared in .C.' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Any - correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.C - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in .C' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - receiver: GET_VAR ': .C declared in .C.' type=.C origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] 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 [fake_override] - 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 [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL <> (_context_receiver_0:.A, _context_receiver_1:.A, _context_receiver_2:.B) returnType:kotlin.Unit - contextReceiverParametersCount: 3 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A - VALUE_PARAMETER name:_context_receiver_1 index:1 type:.A - VALUE_PARAMETER name:_context_receiver_2 index:2 type:.B - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun toFloat (): kotlin.Float declared in kotlin.Int' type=kotlin.Float origin=null - $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_0: .A declared in .f' type=.A origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_1: .A declared in .f' type=.A origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_2: .B declared in .f' type=.B origin=null - PROPERTY name:p visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($receiver:.C, _context_receiver_0:.A, _context_receiver_1:.A, _context_receiver_2:.B) returnType:kotlin.Int - correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] - contextReceiverParametersCount: 3 - $receiver: VALUE_PARAMETER name: type:.C - VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A - VALUE_PARAMETER name:_context_receiver_1 index:1 type:.A - VALUE_PARAMETER name:_context_receiver_2 index:2 type:.B - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun toFloat (): kotlin.Float declared in kotlin.Int' type=kotlin.Float origin=null - $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_0: .A declared in .' type=.A origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_1: .A declared in .' type=.A origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR '_context_receiver_2: .B declared in .' type=.B origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Any declared in .C' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .' type=.C origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Any declared in .C' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .' type=.C origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): kotlin.Any declared in .C' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .C declared in .' type=.C origin=null - RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: .A, _context_receiver_1: .A, _context_receiver_2: .B): kotlin.Int declared in ' - CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.kt.txt deleted file mode 100644 index 37acd8f8ebf..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.fir.kt.txt +++ /dev/null @@ -1,55 +0,0 @@ -class A { - constructor(a: T) /* primary */ { - super/*Any*/() - /* () */ - - } - - val a: T - field = a - get - -} - -class B { - constructor(b: Any) /* primary */ { - super/*Any*/() - /* () */ - - } - - val b: Any - field = b - get - -} - -class C { - constructor(c: Any) /* primary */ { - super/*Any*/() - /* () */ - - } - - val c: Any - field = c - get - -} - -fun f(_context_receiver_0: A, _context_receiver_1: A, _context_receiver_2: B) { - _context_receiver_0.().toFloat() /*~> Unit */ - _context_receiver_1.().() /*~> Unit */ - _context_receiver_2.() /*~> Unit */ -} - -val C.p: Int - get(_context_receiver_0: A, _context_receiver_1: A, _context_receiver_2: B): Int { - _context_receiver_0.().toFloat() /*~> Unit */ - _context_receiver_1.().() /*~> Unit */ - _context_receiver_2.() /*~> Unit */ - .() /*~> Unit */ - .() /*~> Unit */ - .() /*~> Unit */ - return 1 - } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.ir.txt index c7b045f4e7d..082b9a55bca 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.ir.txt @@ -93,43 +93,43 @@ FILE fqName: fileName:/thisWithCustomLabel.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:f visibility:public modality:FINAL <> (:.A, :.A, :.B) returnType:kotlin.Unit + FUN name:f visibility:public modality:FINAL <> (_context_receiver_0:.A, _context_receiver_1:.A, _context_receiver_2:.B) returnType:kotlin.Unit contextReceiverParametersCount: 3 - VALUE_PARAMETER name: index:0 type:.A - VALUE_PARAMETER name: index:1 type:.A - VALUE_PARAMETER name: index:2 type:.B + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A + VALUE_PARAMETER name:_context_receiver_1 index:1 type:.A + VALUE_PARAMETER name:_context_receiver_2 index:2 type:.B BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public open fun toFloat (): kotlin.Float declared in kotlin.Int' type=kotlin.Float origin=null $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .f' type=.A origin=null + $this: GET_VAR '_context_receiver_0: .A declared in .f' type=.A origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .f' type=.A origin=null + $this: GET_VAR '_context_receiver_1: .A declared in .f' type=.A origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .B declared in .f' type=.B origin=null + $this: GET_VAR '_context_receiver_2: .B declared in .f' type=.B origin=null PROPERTY name:p visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($receiver:.C, :.A, :.A, :.B) returnType:kotlin.Int + FUN name: visibility:public modality:FINAL <> ($receiver:.C, _context_receiver_0:.A, _context_receiver_1:.A, _context_receiver_2:.B) returnType:kotlin.Int correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val] contextReceiverParametersCount: 3 $receiver: VALUE_PARAMETER name: type:.C - VALUE_PARAMETER name: index:0 type:.A - VALUE_PARAMETER name: index:1 type:.A - VALUE_PARAMETER name: index:2 type:.B + VALUE_PARAMETER name:_context_receiver_0 index:0 type:.A + VALUE_PARAMETER name:_context_receiver_1 index:1 type:.A + VALUE_PARAMETER name:_context_receiver_2 index:2 type:.B BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public open fun toFloat (): kotlin.Float declared in kotlin.Int' type=kotlin.Float origin=null $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .' type=.A origin=null + $this: GET_VAR '_context_receiver_0: .A declared in .' type=.A origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY $this: CALL 'public final fun (): T of .A declared in .A' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .' type=.A origin=null + $this: GET_VAR '_context_receiver_1: .A declared in .' type=.A origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .B declared in .' type=.B origin=null + $this: GET_VAR '_context_receiver_2: .B declared in .' type=.B origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Any declared in .C' type=kotlin.Any origin=GET_PROPERTY $this: GET_VAR ': .C declared in .' type=.C origin=null @@ -139,5 +139,5 @@ FILE fqName: fileName:/thisWithCustomLabel.kt TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'public final fun (): kotlin.Any declared in .C' type=kotlin.Any origin=GET_PROPERTY $this: GET_VAR ': .C declared in .' type=.C origin=null - RETURN type=kotlin.Nothing from='public final fun (: .A, : .A, : .B): kotlin.Int declared in ' + RETURN type=kotlin.Nothing from='public final fun (_context_receiver_0: .A, _context_receiver_1: .A, _context_receiver_2: .B): kotlin.Int declared in ' CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt index d5f4df19fc7..041c2ecaef1 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class A(val a: T) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt.txt index 26dafd1f5cc..37acd8f8ebf 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/thisWithCustomLabel.kt.txt @@ -37,17 +37,17 @@ class C { } -fun f(: A, : A, : B) { - .().toFloat() /*~> Unit */ - .().() /*~> Unit */ - .() /*~> Unit */ +fun f(_context_receiver_0: A, _context_receiver_1: A, _context_receiver_2: B) { + _context_receiver_0.().toFloat() /*~> Unit */ + _context_receiver_1.().() /*~> Unit */ + _context_receiver_2.() /*~> Unit */ } val C.p: Int - get(: A, : A, : B): Int { - .().toFloat() /*~> Unit */ - .().() /*~> Unit */ - .() /*~> Unit */ + get(_context_receiver_0: A, _context_receiver_1: A, _context_receiver_2: B): Int { + _context_receiver_0.().toFloat() /*~> Unit */ + _context_receiver_1.().() /*~> Unit */ + _context_receiver_2.() /*~> Unit */ .() /*~> Unit */ .() /*~> Unit */ .() /*~> Unit */ diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.ir.txt deleted file mode 100644 index a87bb46109f..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.ir.txt +++ /dev/null @@ -1,27 +0,0 @@ -FILE fqName: fileName:/typeParameterAsContextReceiver.kt - FUN name:useContext visibility:public modality:FINAL (_context_receiver_0:T of .useContext, block:kotlin.Function1.useContext, kotlin.Unit>) returnType:kotlin.Unit - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false - contextReceiverParametersCount: 1 - VALUE_PARAMETER name:_context_receiver_0 index:0 type:T of .useContext - VALUE_PARAMETER name:block index:1 type:kotlin.Function1.useContext, kotlin.Unit> - BLOCK_BODY - FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null - : kotlin.Int - : kotlin.Unit - receiver: CONST Int type=kotlin.Int value=42 - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int - BLOCK_BODY - CALL 'public final fun useContext (_context_receiver_0: T of .useContext, block: kotlin.Function1.useContext, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null - : kotlin.Int - _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null - block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Unit - VALUE_PARAMETER name:i index:0 type:kotlin.Int - BLOCK_BODY - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun toDouble (): kotlin.Double declared in kotlin.Int' type=kotlin.Double origin=null - $this: GET_VAR 'i: kotlin.Int declared in .test..' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.kt.txt deleted file mode 100644 index dd0bd6806f8..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.fir.kt.txt +++ /dev/null @@ -1,12 +0,0 @@ -fun useContext(_context_receiver_0: T, block: Function1) { -} - -fun test() { - with(receiver = 42, block = local fun Int.() { - useContext(_context_receiver_0 = $this$with, block = local fun (i: Int) { - i.toDouble() /*~> Unit */ - } -) - } -) -} diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.ir.txt index 14c3cb5b280..a87bb46109f 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.ir.txt @@ -1,8 +1,8 @@ FILE fqName: fileName:/typeParameterAsContextReceiver.kt - FUN name:useContext visibility:public modality:FINAL (:T of .useContext, block:kotlin.Function1.useContext, kotlin.Unit>) returnType:kotlin.Unit + FUN name:useContext visibility:public modality:FINAL (_context_receiver_0:T of .useContext, block:kotlin.Function1.useContext, kotlin.Unit>) returnType:kotlin.Unit TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:T of .useContext + VALUE_PARAMETER name:_context_receiver_0 index:0 type:T of .useContext VALUE_PARAMETER name:block index:1 type:kotlin.Function1.useContext, kotlin.Unit> BLOCK_BODY FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit @@ -15,9 +15,9 @@ FILE fqName: fileName:/typeParameterAsContextReceiver.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int BLOCK_BODY - CALL 'public final fun useContext (: T of .useContext, block: kotlin.Function1.useContext, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null + CALL 'public final fun useContext (_context_receiver_0: T of .useContext, block: kotlin.Function1.useContext, kotlin.Unit>): kotlin.Unit declared in ' type=kotlin.Unit origin=null : kotlin.Int - : GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .test.' type=kotlin.Int origin=null block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:i index:0 type:kotlin.Int diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt index 06cb23919c0..9e903898511 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers context(T) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt.txt index 8d11cfa8d3f..dd0bd6806f8 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/typeParameterAsContextReceiver.kt.txt @@ -1,9 +1,9 @@ -fun useContext(: T, block: Function1) { +fun useContext(_context_receiver_0: T, block: Function1) { } fun test() { with(receiver = 42, block = local fun Int.() { - useContext( = $this$with, block = local fun (i: Int) { + useContext(_context_receiver_0 = $this$with, block = local fun (i: Int) { i.toDouble() /*~> Unit */ } ) diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.ir.txt index c6147e9b6d4..90bce5f0f78 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.ir.txt @@ -103,32 +103,32 @@ FILE fqName: fileName:/unaryOperators.kt BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null - FUN name:unaryMinus visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int) returnType:.Result [operator] + FUN name:unaryMinus visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .unaryMinus' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun unaryMinus (: kotlin.Int): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .unaryMinus' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun unaryMinus (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun unaryMinus (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=UMINUS $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .unaryMinus' type=.Result origin=null - FUN name:unaryPlus visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int) returnType:.Result [operator] + FUN name:unaryPlus visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .unaryPlus' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun unaryPlus (: kotlin.Int): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .unaryPlus' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun unaryPlus (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: WHEN type=kotlin.Int origin=IF BRANCH @@ -143,33 +143,33 @@ FILE fqName: fileName:/unaryOperators.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .unaryPlus' type=.Result origin=null - FUN name:inc visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int) returnType:.Result [operator] + FUN name:inc visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .inc' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun inc (: kotlin.Int): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .inc' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun inc (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .Result declared in .inc' type=.Result origin=null other: CONST Int type=kotlin.Int value=1 - FUN name:dec visibility:public modality:FINAL <> ($receiver:.Result, :kotlin.Int) returnType:.Result [operator] + FUN name:dec visibility:public modality:FINAL <> ($receiver:.Result, _context_receiver_0:kotlin.Int) returnType:.Result [operator] contextReceiverParametersCount: 1 $receiver: VALUE_PARAMETER name: type:.Result - VALUE_PARAMETER name: index:0 type:kotlin.Int + VALUE_PARAMETER name:_context_receiver_0 index:0 type:kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ - other: GET_VAR ': kotlin.Int declared in .dec' type=kotlin.Int origin=null - RETURN type=kotlin.Nothing from='public final fun dec (: kotlin.Int): .Result [operator] declared in ' + other: GET_VAR '_context_receiver_0: kotlin.Int declared in .dec' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun dec (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' CONSTRUCTOR_CALL 'public constructor (i: kotlin.Int) [primary] declared in .Result' type=.Result origin=null i: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS $this: CALL 'public final fun (): kotlin.Int declared in .Result' type=kotlin.Int origin=GET_PROPERTY @@ -194,35 +194,35 @@ FILE fqName: fileName:/unaryOperators.kt VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Result [val] GET_VAR 'var result: .Result [var] declared in .box' type=.Result origin=POSTFIX_INCR SET_VAR 'var result: .Result [var] declared in .box' type=kotlin.Unit origin=POSTFIX_INCR - CALL 'public final fun inc (: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_INCR + CALL 'public final fun inc (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_INCR $receiver: GET_VAR 'val tmp_1: .Result [val] declared in .box.' type=.Result origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null GET_VAR 'val tmp_1: .Result [val] declared in .box.' type=.Result origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit BLOCK type=.Result origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Result [val] GET_VAR 'var result: .Result [var] declared in .box' type=.Result origin=POSTFIX_INCR SET_VAR 'var result: .Result [var] declared in .box' type=kotlin.Unit origin=POSTFIX_INCR - CALL 'public final fun inc (: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_INCR + CALL 'public final fun inc (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_INCR $receiver: GET_VAR 'val tmp_2: .Result [val] declared in .box.' type=.Result origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null GET_VAR 'val tmp_2: .Result [val] declared in .box.' type=.Result origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun unaryMinus (: kotlin.Int): .Result [operator] declared in ' type=.Result origin=UMINUS + CALL 'public final fun unaryMinus (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' type=.Result origin=UMINUS $receiver: GET_VAR 'var result: .Result [var] declared in .box' type=.Result origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun unaryPlus (: kotlin.Int): .Result [operator] declared in ' type=.Result origin=UPLUS + CALL 'public final fun unaryPlus (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' type=.Result origin=UPLUS $receiver: GET_VAR 'var result: .Result [var] declared in .box' type=.Result origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='local final fun (): .Result declared in .box' BLOCK type=.Result origin=POSTFIX_DECR VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:.Result [val] GET_VAR 'var result: .Result [var] declared in .box' type=.Result origin=POSTFIX_DECR SET_VAR 'var result: .Result [var] declared in .box' type=kotlin.Unit origin=POSTFIX_DECR - CALL 'public final fun dec (: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_DECR + CALL 'public final fun dec (_context_receiver_0: kotlin.Int): .Result [operator] declared in ' type=.Result origin=POSTFIX_DECR $receiver: GET_VAR 'val tmp_3: .Result [val] declared in .box.' type=.Result origin=null - : GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null + _context_receiver_0: GET_VAR '$this$with: kotlin.Int declared in .box.' type=kotlin.Int origin=null GET_VAR 'val tmp_3: .Result [val] declared in .box.' type=.Result origin=null RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' WHEN type=kotlin.String origin=IF diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.kt.txt index 2ce505a1ee6..52f6bb7b210 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/unaryOperators.kt.txt @@ -46,16 +46,16 @@ var operationScore: Int get set -operator fun Result.unaryMinus(: Int): Result { +operator fun Result.unaryMinus(_context_receiver_0: Int): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().unaryMinus()) } -operator fun Result.unaryPlus(: Int): Result { +operator fun Result.unaryPlus(_context_receiver_0: Int): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = when { less(arg0 = .(), arg1 = 0) -> .().unaryMinus() @@ -63,16 +63,16 @@ operator fun Result.unaryPlus(: Int): Result { }) } -operator fun Result.inc(: Int): Result { +operator fun Result.inc(_context_receiver_0: Int): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().plus(other = 1)) } -operator fun Result.dec(: Int): Result { +operator fun Result.dec(_context_receiver_0: Int): Result { { // BLOCK - ( = ().plus(other = )) + ( = ().plus(other = _context_receiver_0)) } return Result(i = .().minus(other = 1)) } @@ -82,19 +82,19 @@ fun box(): String { with(receiver = 1, block = local fun Int.(): Result { { // BLOCK val tmp0: Result = result - result = tmp0.inc( = $this$with) + result = tmp0.inc(_context_receiver_0 = $this$with) tmp0 } /*~> Unit */ { // BLOCK val tmp1: Result = result - result = tmp1.inc( = $this$with) + result = tmp1.inc(_context_receiver_0 = $this$with) tmp1 } /*~> Unit */ - result.unaryMinus( = $this$with) /*~> Unit */ - result.unaryPlus( = $this$with) /*~> Unit */ + result.unaryMinus(_context_receiver_0 = $this$with) /*~> Unit */ + result.unaryPlus(_context_receiver_0 = $this$with) /*~> Unit */ return { // BLOCK val tmp2: Result = result - result = tmp2.dec( = $this$with) + result = tmp2.dec(_context_receiver_0 = $this$with) tmp2 } } diff --git a/core/compiler.common/src/org/jetbrains/kotlin/name/NameUtils.kt b/core/compiler.common/src/org/jetbrains/kotlin/name/NameUtils.kt index 05355790b36..418fda09e78 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/name/NameUtils.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/name/NameUtils.kt @@ -61,4 +61,8 @@ object NameUtils { fun propertyDelegateName(propertyName: Name): Name { return Name.identifier("${propertyName.asString()}\$delegate") } + + @JvmStatic + fun contextReceiverName(index: Int): Name = + Name.identifier("_context_receiver_$index") } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractReceiverParameterDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractReceiverParameterDescriptor.java index e8bea7bff1b..221fcf23491 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractReceiverParameterDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractReceiverParameterDescriptor.java @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.annotations.Annotations; +import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.name.SpecialNames; import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver; import org.jetbrains.kotlin.types.KotlinType; @@ -36,6 +37,10 @@ public abstract class AbstractReceiverParameterDescriptor extends DeclarationDes super(annotations, SpecialNames.THIS); } + public AbstractReceiverParameterDescriptor(@NotNull Annotations annotations, @NotNull Name name) { + super(annotations, name); + } + @Nullable @Override public ReceiverParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor) { diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/FunctionDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/FunctionDescriptorImpl.java index 666dc0aab48..dc2fe0d6b43 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/FunctionDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/FunctionDescriptorImpl.java @@ -628,6 +628,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo List substitutedContextReceiverParameters = new ArrayList(); if (!configuration.newContextReceiverParameters.isEmpty()) { + int index = 0; for (ReceiverParameterDescriptor newContextReceiverParameter : configuration.newContextReceiverParameters) { KotlinType substitutedContextReceiverType = substitutor.substitute(newContextReceiverParameter.getType(), Variance.IN_VARIANCE); @@ -637,7 +638,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo ReceiverParameterDescriptor substitutedContextReceiverParameter = DescriptorFactory.createContextReceiverParameterForCallable(substitutedDescriptor, substitutedContextReceiverType, ((ImplicitContextReceiver)newContextReceiverParameter.getValue()).getCustomLabelName(), - newContextReceiverParameter.getAnnotations()); + newContextReceiverParameter.getAnnotations(), + index++); substitutedContextReceiverParameters.add(substitutedContextReceiverParameter); wereChanges[0] |= substitutedContextReceiverType != newContextReceiverParameter.getType(); diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ReceiverParameterDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ReceiverParameterDescriptorImpl.java index 4c3147a5e6a..dd323f6051d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ReceiverParameterDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ReceiverParameterDescriptorImpl.java @@ -20,6 +20,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.descriptors.DeclarationDescriptor; import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor; import org.jetbrains.kotlin.descriptors.annotations.Annotations; +import org.jetbrains.kotlin.name.Name; +import org.jetbrains.kotlin.name.SpecialNames; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.types.KotlinType; import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt; @@ -33,7 +35,16 @@ public class ReceiverParameterDescriptorImpl extends AbstractReceiverParameterDe @NotNull ReceiverValue value, @NotNull Annotations annotations ) { - super(annotations); + this(containingDeclaration, value, annotations, SpecialNames.THIS); + } + + public ReceiverParameterDescriptorImpl( + @NotNull DeclarationDescriptor containingDeclaration, + @NotNull ReceiverValue value, + @NotNull Annotations annotations, + @NotNull Name name + ) { + super(annotations, name); this.containingDeclaration = containingDeclaration; this.value = value; } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java index 04783bd293f..9432ed863e8 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorFactory.java @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.annotations.Annotations; import org.jetbrains.kotlin.descriptors.impl.*; import org.jetbrains.kotlin.name.Name; +import org.jetbrains.kotlin.name.NameUtils; import org.jetbrains.kotlin.name.StandardClassIds; import org.jetbrains.kotlin.resolve.scopes.receivers.ContextClassReceiver; import org.jetbrains.kotlin.resolve.scopes.receivers.ContextReceiver; @@ -231,11 +232,13 @@ public class DescriptorFactory { @NotNull CallableDescriptor owner, @Nullable KotlinType receiverParameterType, @Nullable Name customLabelName, - @NotNull Annotations annotations + @NotNull Annotations annotations, + int index ) { return receiverParameterType == null ? null - : new ReceiverParameterDescriptorImpl(owner, new ContextReceiver(owner, receiverParameterType, customLabelName, null), annotations); + : new ReceiverParameterDescriptorImpl(owner, new ContextReceiver(owner, receiverParameterType, customLabelName, null), annotations, + NameUtils.contextReceiverName(index)); } @Nullable diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt index 640669d8afc..40a913ab724 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt @@ -60,7 +60,7 @@ class MemberDeserializer(private val c: DeserializationContext) { proto.receiverType(c.typeTable)?.let(local.typeDeserializer::type)?.let { receiverType -> DescriptorFactory.createExtensionReceiverParameterForCallable(property, receiverType, receiverAnnotations) }, - proto.contextReceiverTypes(c.typeTable).map { it.toContextReceiver(local, property) } + proto.contextReceiverTypes(c.typeTable).mapIndexed { index, type -> type.toContextReceiver(local, property, index) } ) // Per documentation on Property.getter_flags in metadata.proto, if an accessor flags field is absent, its value should be computed @@ -212,7 +212,7 @@ class MemberDeserializer(private val c: DeserializationContext) { DescriptorFactory.createExtensionReceiverParameterForCallable(function, receiverType, receiverAnnotations) }, getDispatchReceiverParameter(), - proto.contextReceiverTypes(c.typeTable).mapNotNull { it.toContextReceiver(local, function) }, + proto.contextReceiverTypes(c.typeTable).mapIndexedNotNull { index, type -> type.toContextReceiver(local, function, index) }, local.typeDeserializer.ownTypeParameters, local.memberDeserializer.valueParameters(proto.valueParameterList, proto, AnnotatedCallableKind.FUNCTION), local.typeDeserializer.type(proto.returnType(c.typeTable)), @@ -355,14 +355,16 @@ class MemberDeserializer(private val c: DeserializationContext) { private fun ProtoBuf.Type.toContextReceiver( deserializationContext: DeserializationContext, - callableDescriptor: CallableDescriptor + callableDescriptor: CallableDescriptor, + index: Int ): ReceiverParameterDescriptor? { val contextReceiverType = deserializationContext.typeDeserializer.type(this) return DescriptorFactory.createContextReceiverParameterForCallable( callableDescriptor, contextReceiverType, /* customLabelName = */ null/*todo store custom label name in metadata?*/, - Annotations.EMPTY + Annotations.EMPTY, + index ) } }