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 bb64d26cb19..a7358d67ae8 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 @@ -297,23 +297,23 @@ class Fir2IrDeclarationStorage( for ((index, typeParameter) in function.typeParameters.withIndex()) { typeParameters += getIrTypeParameter(typeParameter, index).apply { this.parent = parent } } - val receiverTypeRef = function.receiverTypeRef - if (receiverTypeRef != null) { - extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset -> - val type = receiverTypeRef.toIrType(session, this@Fir2IrDeclarationStorage) - val receiverDescriptor = WrappedReceiverParameterDescriptor() - irSymbolTable.declareValueParameter( - startOffset, endOffset, thisOrigin, - receiverDescriptor, type - ) { symbol -> - IrValueParameterImpl( - startOffset, endOffset, thisOrigin, symbol, - Name.special(""), -1, type, - varargElementType = null, isCrossinline = false, isNoinline = false - ).apply { - this.parent = parent - receiverDescriptor.bind(this) - } + } + val receiverTypeRef = function?.receiverTypeRef + if (receiverTypeRef != null) { + extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset -> + val type = receiverTypeRef.toIrType(session, this@Fir2IrDeclarationStorage) + val receiverDescriptor = WrappedReceiverParameterDescriptor() + irSymbolTable.declareValueParameter( + startOffset, endOffset, thisOrigin, + receiverDescriptor, type + ) { symbol -> + IrValueParameterImpl( + startOffset, endOffset, thisOrigin, symbol, + Name.special(""), -1, type, + varargElementType = null, isCrossinline = false, isNoinline = false + ).apply { + this.parent = parent + receiverDescriptor.bind(this) } } } diff --git a/compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt b/compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt index e619db6e788..178dbe11915 100644 --- a/compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt +++ b/compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS, NATIVE diff --git a/compiler/testData/codegen/box/nonLocalReturns/kt9644let.kt b/compiler/testData/codegen/box/nonLocalReturns/kt9644let.kt index b55d228fa27..2c6ac23a297 100644 --- a/compiler/testData/codegen/box/nonLocalReturns/kt9644let.kt +++ b/compiler/testData/codegen/box/nonLocalReturns/kt9644let.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME diff --git a/compiler/testData/ir/irText/classes/initValInLambda.fir.txt b/compiler/testData/ir/irText/classes/initValInLambda.fir.txt index fc18f825e2f..c80fa176eab 100644 --- a/compiler/testData/ir/irText/classes/initValInLambda.fir.txt +++ b/compiler/testData/ir/irText/classes/initValInLambda.fir.txt @@ -21,8 +21,9 @@ FILE fqName: fileName:/initValInLambda.kt : kotlin.Nothing $receiver: CONST Int type=kotlin.Int value=1 block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($this:.TestInitValInLambdaCalledOnce) returnType:kotlin.Nothing + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($this:.TestInitValInLambdaCalledOnce, $receiver:kotlin.Int) returnType:kotlin.Nothing $this: VALUE_PARAMETER name: type:.TestInitValInLambdaCalledOnce + $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Unit origin=null receiver: GET_VAR ': .TestInitValInLambdaCalledOnce declared in .TestInitValInLambdaCalledOnce' type=.TestInitValInLambdaCalledOnce origin=null diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt index 9e31b31ffdf..27cab54a107 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt @@ -5,7 +5,8 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt VALUE_PARAMETER name:runA index:0 type:kotlin.Function2<.A, kotlin.String, kotlin.Unit> EXPRESSION_BODY FUN_EXPR type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.A, it:kotlin.String) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:it index:0 type:kotlin.String BLOCK_BODY GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.txt index 6e579594655..5bad310fee6 100644 --- a/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.txt +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.fir.txt @@ -16,7 +16,8 @@ FILE fqName: fileName:/lambdas.kt FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Function2 visibility:private [final,static] EXPRESSION_BODY FUN_EXPR type=kotlin.Function2 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Int + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Any, it:kotlin.Any) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:it index:0 type:kotlin.Any BLOCK_BODY CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.fir.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.fir.txt index a4683ba6272..ecc5863cc8c 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.fir.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.fir.txt @@ -7,7 +7,8 @@ FILE fqName: fileName:/extensionLambda.kt : kotlin.Int $receiver: CONST String type=kotlin.String value="42" block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.String) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name: type:kotlin.String BLOCK_BODY CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=null - $this: ERROR_CALL 'Unresolved reference: this@R|special/anonymous|' type=kotlin.String + $this: GET_VAR ': kotlin.String declared in .' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.txt index e88adefba39..723f7ea2f18 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.fir.txt @@ -89,21 +89,24 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt : kotlin.Int receiver: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.A block: FUN_EXPR type=kotlin.Function1<.A, kotlin.Int> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.A) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name: type:.A BLOCK_BODY CALL 'public final fun with (receiver: T of kotlin.with, block: kotlin.Function1): R of kotlin.with [inline] declared in kotlin' type=kotlin.Int origin=null : .IFoo : kotlin.Int receiver: GET_VAR 'fooImpl: .IFoo declared in .test' type=.IFoo origin=null block: FUN_EXPR type=kotlin.Function1<.IFoo, kotlin.Int> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.IFoo) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name: type:.IFoo BLOCK_BODY CALL 'public final fun with (receiver: T of kotlin.with, block: kotlin.Function1): R of kotlin.with [inline] declared in kotlin' type=kotlin.Int origin=null : .IInvoke : kotlin.Int receiver: GET_VAR 'invokeImpl: .IInvoke declared in .test' type=.IInvoke origin=null block: FUN_EXPR type=kotlin.Function1<.IInvoke, kotlin.Int> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.IInvoke) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name: type:.IInvoke BLOCK_BODY CALL 'public open fun invoke (): kotlin.Int [operator] declared in .IInvoke' type=kotlin.Int origin=null - $this: ERROR_CALL 'Unresolved reference: this@R|special/anonymous|' type=.IInvoke + $this: GET_VAR ': .IInvoke declared in .' type=.IInvoke origin=null diff --git a/compiler/testData/ir/irText/stubs/builtinMap.fir.txt b/compiler/testData/ir/irText/stubs/builtinMap.fir.txt index bfbf582f470..a0e03c17572 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.fir.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.fir.txt @@ -23,10 +23,11 @@ FILE fqName: fileName:/builtinMap.kt : V1 of .plus p0: GET_VAR ': kotlin.collections.Map.plus, V1 of .plus> declared in .plus' type=kotlin.collections.Map.plus, V1 of .plus> origin=null block: FUN_EXPR type=kotlin.Function1.plus, V1 of .plus>, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:java.util.LinkedHashMap.plus, V1 of .plus>) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name: type:java.util.LinkedHashMap.plus, V1 of .plus> BLOCK_BODY CALL 'public open fun put (p0: K1 of .plus, p1: V1 of .plus): V1 of .plus? [operator] declared in java.util.HashMap' type=V1 of .plus? origin=null - $this: ERROR_CALL 'Unresolved reference: this@R|special/anonymous|' type=java.util.LinkedHashMap.plus, V1 of .plus> + $this: GET_VAR ': java.util.LinkedHashMap.plus, V1 of .plus> declared in .' type=java.util.LinkedHashMap.plus, V1 of .plus> origin=null p0: CALL 'public final fun (): K1 of .plus declared in kotlin.Pair' type=K1 of .plus origin=null $this: GET_VAR 'pair: kotlin.Pair.plus, V1 of .plus> declared in .plus' type=kotlin.Pair.plus, V1 of .plus> origin=null p1: CALL 'public final fun (): V1 of .plus declared in kotlin.Pair' type=V1 of .plus origin=null