diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt index d90c5cd457f..41d77f0f62b 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt @@ -42,7 +42,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio constructor(context: GeneratorContext) : this(DeclarationGenerator(context)) - fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrFunction = + fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrSimpleFunction = declareSimpleFunction( ktFunction, ktFunction.receiverTypeReference, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt index 15f6e19a23d..26d31213045 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt @@ -17,55 +17,30 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.IrFunction -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl -import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionReferenceImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.psi.KtLambdaExpression import org.jetbrains.kotlin.psi.KtNamedFunction import org.jetbrains.kotlin.psi.psiUtil.endOffset -import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments +import org.jetbrains.kotlin.psi.psiUtil.startOffset class LocalFunctionGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) { + fun generateLambda(ktLambda: KtLambdaExpression): IrStatement { val ktFun = ktLambda.functionLiteral val lambdaExpressionType = getInferredTypeWithImplicitCastsOrFail(ktLambda).toIrType() val irLambdaFunction = FunctionGenerator(context).generateLambdaFunctionDeclaration(ktFun) - val irBlock = IrBlockImpl(ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, IrStatementOrigin.LAMBDA) - irBlock.statements.add(irLambdaFunction) - irBlock.statements.add( - IrFunctionReferenceImpl( - ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, - irLambdaFunction.symbol, irLambdaFunction.symbol.descriptor, 0, - IrStatementOrigin.LAMBDA - ) - ) - return irBlock + return IrFunctionExpressionImpl(ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, irLambdaFunction) } - fun generateFunction(ktFun: KtNamedFunction): IrStatement = - if (ktFun.name != null) { - generateFunctionDeclaration(ktFun) - } else { - // anonymous function expression - val funExpressionType = getInferredTypeWithImplicitCastsOrFail(ktFun).toIrType() - val irBlock = IrBlockImpl(ktFun.startOffsetSkippingComments, ktFun.endOffset, funExpressionType, IrStatementOrigin.ANONYMOUS_FUNCTION) + fun generateFunction(ktFun: KtNamedFunction): IrStatement { + val irFun = generateFunctionDeclaration(ktFun) + if (ktFun.name != null) return irFun - val irFun = generateFunctionDeclaration(ktFun) - irBlock.statements.add(irFun) + val funExpressionType = getInferredTypeWithImplicitCastsOrFail(ktFun).toIrType() + return IrFunctionExpressionImpl(ktFun.startOffset, ktFun.endOffset, funExpressionType, irFun) + } - irBlock.statements.add( - IrFunctionReferenceImpl( - ktFun.startOffsetSkippingComments, ktFun.endOffset, funExpressionType, - irFun.symbol, irFun.symbol.descriptor, 0, - IrStatementOrigin.ANONYMOUS_FUNCTION - ) - ) - - irBlock - } - - private fun generateFunctionDeclaration(ktFun: KtNamedFunction): IrFunction = + private fun generateFunctionDeclaration(ktFun: KtNamedFunction) = FunctionGenerator(context).generateFunctionDeclaration(ktFun) } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionExpression.kt new file mode 100644 index 00000000000..31a47576272 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrFunctionExpression.kt @@ -0,0 +1,14 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.expressions + +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction + +interface IrFunctionExpression : IrExpression { + + var function: IrSimpleFunction + +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt new file mode 100644 index 00000000000..751dbeada80 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.expressions.impl + +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.visitors.IrElementTransformer +import org.jetbrains.kotlin.ir.visitors.IrElementVisitor + +class IrFunctionExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + override var function: IrSimpleFunction +) : + IrExpressionBase(startOffset, endOffset, type), + IrFunctionExpression { + + override fun accept(visitor: IrElementVisitor, data: D): R { + return visitor.visitFunctionExpression(this, data) + } + + override fun acceptChildren(visitor: IrElementVisitor, data: D) { + function.accept(visitor, data) + } + + override fun transformChildren(transformer: IrElementTransformer, data: D) { + function = function.transform(transformer, data) as IrSimpleFunction + } +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt index c8f22ffa680..90e21f73240 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt @@ -589,6 +589,13 @@ open class DeepCopyIrTreeWithSymbols( mapStatementOrigin(expression.origin) ) + override fun visitFunctionExpression(expression: IrFunctionExpression): IrFunctionExpression = + IrFunctionExpressionImpl( + expression.startOffset, expression.endOffset, + expression.type.remapType(), + expression.function.transform() + ) + override fun visitClassReference(expression: IrClassReference): IrClassReference = IrClassReferenceImpl( expression.startOffset, expression.endOffset, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt index 54640545a81..0ac6728ea8b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt @@ -601,6 +601,11 @@ class RenderIrElementVisitor : IrElementVisitor { append("origin=${expression.origin}") } + override fun visitFunctionExpression(expression: IrFunctionExpression, data: Nothing?): String = + buildTrimEnd { + append("FUN_EXPR type=${expression.type.render()}") + } + override fun visitClassReference(expression: IrClassReference, data: Nothing?): String = "CLASS_REFERENCE '${expression.symbol.renderReference()}' type=${expression.type.render()}" diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt index 21b3f89333f..b0de6548987 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformer.kt @@ -98,6 +98,8 @@ interface IrElementTransformer : IrElementVisitor { override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: D) = visitCallableReference(expression, data) + override fun visitFunctionExpression(expression: IrFunctionExpression, data: D): IrElement = visitExpression(expression, data) + override fun visitClassReference(expression: IrClassReference, data: D) = visitDeclarationReference(expression, data) override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: D) = visitExpression(expression, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt index c6f19d2abd9..bbe8ef6499e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementTransformerVoid.kt @@ -194,6 +194,10 @@ abstract class IrElementTransformerVoid : IrElementTransformer { final override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: Nothing?) = visitLocalDelegatedPropertyReference(expression) + open fun visitFunctionExpression(expression: IrFunctionExpression) = visitExpression(expression) + final override fun visitFunctionExpression(expression: IrFunctionExpression, data: Nothing?): IrElement = + visitFunctionExpression(expression) + open fun visitClassReference(expression: IrClassReference) = visitDeclarationReference(expression) final override fun visitClassReference(expression: IrClassReference, data: Nothing?) = visitClassReference(expression) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt index 8ff1ab7c908..7c8a1fd7b9f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitor.kt @@ -84,6 +84,8 @@ interface IrElementVisitor { fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: D) = visitCallableReference(expression, data) + fun visitFunctionExpression(expression: IrFunctionExpression, data: D) = visitExpression(expression, data) + fun visitClassReference(expression: IrClassReference, data: D) = visitDeclarationReference(expression, data) fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall, data: D) = visitExpression(expression, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt index a5214f891c1..067a7ec6f52 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/visitors/IrElementVisitorVoid.kt @@ -184,6 +184,9 @@ interface IrElementVisitorVoid : IrElementVisitor { override fun visitLocalDelegatedPropertyReference(expression: IrLocalDelegatedPropertyReference, data: Nothing?) = visitLocalDelegatedPropertyReference(expression) + fun visitFunctionExpression(expression: IrFunctionExpression) = visitExpression(expression) + override fun visitFunctionExpression(expression: IrFunctionExpression, data: Nothing?) = visitFunctionExpression(expression) + fun visitClassReference(expression: IrClassReference) = visitDeclarationReference(expression) override fun visitClassReference(expression: IrClassReference, data: Nothing?) = visitClassReference(expression) diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt index b8fcf63faae..1be2f7f11b7 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.txt @@ -4,14 +4,13 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt CONSTRUCTOR visibility:public <> (runA:@[ExtensionFunctionType] kotlin.Function2<.A, kotlin.String, kotlin.Unit>) returnType:.A [primary] VALUE_PARAMETER name:runA index:0 type:@[ExtensionFunctionType] kotlin.Function2<.A, kotlin.String, kotlin.Unit> EXPRESSION_BODY - BLOCK type=@[ExtensionFunctionType] kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=LAMBDA + FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function2<.A, kotlin.String, 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 RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String): kotlin.Unit declared in .A.' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (it: kotlin.String): kotlin.Unit declared in .A.' type=@[ExtensionFunctionType] kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=LAMBDA BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public [data] superTypes:[kotlin.Any]' diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.txt index 265e51e88f3..2dcdf3fb838 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.txt @@ -22,12 +22,11 @@ FILE fqName: fileName:/delegateFieldWithAnnotations.kt EXPRESSION_BODY CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1$delegate' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test1$delegate' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [delegated,val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.txt index af8162988bc..054ff313d57 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.txt @@ -36,12 +36,11 @@ FILE fqName: fileName:/localDelegatedPropertiesWithAnnotations.kt VAR DELEGATE name:test$delegate type:kotlin.Lazy [val] CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .foo' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .foo' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .foo' diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.txt index f12246f17e7..66c8ca1f477 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.txt @@ -96,12 +96,11 @@ FILE fqName: fileName:/classLevelProperties.kt EXPRESSION_BODY CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .C.test7$delegate' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .C.test7$delegate' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [delegated,val] $this: VALUE_PARAMETER name: type:.C diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.txt index 84297c4b668..4344918052e 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.txt @@ -4,12 +4,11 @@ FILE fqName: fileName:/delegatedProperties.kt EXPRESSION_BODY CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1$delegate' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test1$delegate' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [delegated,val] BLOCK_BODY @@ -42,12 +41,11 @@ FILE fqName: fileName:/delegatedProperties.kt EXPRESSION_BODY CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .C.test2$delegate' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .C.test2$delegate' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [delegated,val] $this: VALUE_PARAMETER name: type:.C diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt index fca3232492a..5eb2a5be874 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.txt @@ -5,12 +5,11 @@ FILE fqName: fileName:/localDelegatedProperties.kt VAR DELEGATE name:x$delegate type:kotlin.Lazy [val] CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt index 5fec8eeed1a..c1b76d48734 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt @@ -73,12 +73,11 @@ FILE fqName: fileName:/packageLevelProperties.kt EXPRESSION_BODY CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null : kotlin.Int - initializer: BLOCK type=kotlin.Function0 origin=LAMBDA + initializer: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test7$delegate' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test7$delegate' type=kotlin.Function0 origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [delegated,val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.txt index 6fec298c9a4..ef46221e0a7 100644 --- a/compiler/testData/ir/irText/declarations/parameters/lambdas.txt +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.txt @@ -2,13 +2,12 @@ FILE fqName: fileName:/lambdas.kt PROPERTY name:test1 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Function1 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function1 origin=LAMBDA + FUN_EXPR type=kotlin.Function1 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.String VALUE_PARAMETER name:it index:0 type:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String): kotlin.String declared in .test1' GET_VAR 'it: kotlin.String declared in .test1.' type=kotlin.String origin=null - FUNCTION_REFERENCE 'local final fun (it: kotlin.String): kotlin.String declared in .test1' type=kotlin.Function1 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function1 correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val] BLOCK_BODY @@ -17,7 +16,7 @@ FILE fqName: fileName:/lambdas.kt PROPERTY name:test2 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test2 type:@[ExtensionFunctionType] kotlin.Function2 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=@[ExtensionFunctionType] kotlin.Function2 origin=LAMBDA + FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function2 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 @@ -25,7 +24,6 @@ FILE fqName: fileName:/lambdas.kt RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Any): kotlin.Int declared in .test2' CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null $this: GET_VAR 'it: kotlin.Any declared in .test2.' type=kotlin.Any origin=null - FUNCTION_REFERENCE 'local final fun (it: kotlin.Any): kotlin.Int declared in .test2' type=@[ExtensionFunctionType] kotlin.Function2 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:@[ExtensionFunctionType] kotlin.Function2 correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val] BLOCK_BODY @@ -34,14 +32,13 @@ FILE fqName: fileName:/lambdas.kt PROPERTY name:test3 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Function2 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function2 origin=LAMBDA + FUN_EXPR type=kotlin.Function2 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (i:kotlin.Int, j:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:i index:0 type:kotlin.Int VALUE_PARAMETER name:j index:1 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (i: kotlin.Int, j: kotlin.Int): kotlin.Unit declared in .test3' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (i: kotlin.Int, j: kotlin.Int): kotlin.Unit declared in .test3' type=kotlin.Function2 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function2 correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val] BLOCK_BODY @@ -50,12 +47,11 @@ FILE fqName: fileName:/lambdas.kt PROPERTY name:test4 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Function2 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function2 origin=ANONYMOUS_FUNCTION + FUN_EXPR type=kotlin.Function2 FUN name: visibility:local modality:FINAL <> (i:kotlin.Int, j:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:i index:0 type:kotlin.Int VALUE_PARAMETER name:j index:1 type:kotlin.Int BLOCK_BODY - FUNCTION_REFERENCE 'local final fun (i: kotlin.Int, j: kotlin.Int): kotlin.Unit declared in .test4' type=kotlin.Function2 origin=ANONYMOUS_FUNCTION FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function2 correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.txt index cf1fd930a00..1af62d88192 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.txt @@ -16,12 +16,11 @@ FILE fqName: fileName:/badBreakContinue.kt condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null VAR name:lambda type:kotlin.Function0 [val] - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing BLOCK_BODY ERROR_EXPR 'Loop not found for break expression: break@L1' type=kotlin.Nothing ERROR_EXPR 'Loop not found for continue expression: continue@L1' type=kotlin.Nothing - FUNCTION_REFERENCE 'local final fun (): kotlin.Nothing declared in .test3' type=kotlin.Function0 origin=LAMBDA FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY WHILE label=null origin=WHILE_LOOP diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.txt index d01d2818e25..63940ebdc8f 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.txt @@ -2,13 +2,12 @@ FILE fqName: fileName:/coercionToUnit.kt PROPERTY name:test1 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Function0 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function0 correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.txt index 5c7120721c2..c02b339fd10 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.txt @@ -28,13 +28,12 @@ FILE fqName: fileName:/enumEntryAsReceiver.kt PROPERTY name:value visibility:public modality:OPEN [val] FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Function0 visibility:public [final] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .X.B.value' CALL 'public final fun (): kotlin.String declared in .X.B' type=kotlin.String origin=GET_PROPERTY $this: GET_ENUM 'ENUM_ENTRY name:B' type=.X.B - FUNCTION_REFERENCE 'local final fun (): kotlin.String declared in .X.B.value' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.X.B) returnType:kotlin.Function0 correspondingProperty: PROPERTY name:value visibility:public modality:OPEN [val] overridden: diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt index c4f7c5faaa1..85bcfd226fb 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt @@ -47,7 +47,7 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt PROPERTY name:aLambda visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:aLambda type:kotlin.Function0 visibility:public [final] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=EQ @@ -56,7 +56,6 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyEnum.Z.aLambda' CALL 'public final fun foo (): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=null $this: GET_ENUM 'ENUM_ENTRY name:Z' type=.MyEnum.Z - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .MyEnum.Z.aLambda' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyEnum.Z) returnType:kotlin.Function0 correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.MyEnum.Z diff --git a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.txt b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.txt index 2ba1f43c2f0..4b6a3a29828 100644 --- a/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.txt +++ b/compiler/testData/ir/irText/expressions/genericConstructorCallWithTypeArguments.txt @@ -17,14 +17,13 @@ FILE fqName: fileName:/genericConstructorCallWithTypeArguments.kt CONSTRUCTOR_CALL 'public constructor (size: kotlin.Int, init: kotlin.Function1) declared in kotlin.Array' type=kotlin.Array.testArray> origin=null : T of .testArray size: GET_VAR 'n: kotlin.Int declared in .testArray' type=kotlin.Int origin=null - init: BLOCK type=kotlin.Function1.testArray> origin=LAMBDA + init: FUN_EXPR type=kotlin.Function1.testArray> FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:T of .testArray VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): T of .testArray declared in .testArray' CALL 'public abstract fun invoke (): R of kotlin.Function0 declared in kotlin.Function0' type=T of .testArray origin=INVOKE $this: GET_VAR 'block: kotlin.Function0.testArray> [crossinline] declared in .testArray' type=kotlin.Function0.testArray> origin=VARIABLE_AS_FUNCTION - FUNCTION_REFERENCE 'local final fun (it: kotlin.Int): T of .testArray declared in .testArray' type=kotlin.Function1.testArray> origin=LAMBDA CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Box.Box> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.txt index 2abb1c62456..63d12829b30 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.txt @@ -19,12 +19,11 @@ FILE fqName: fileName:/lambdaInCAO.kt BLOCK_BODY CALL 'public final fun plusAssign (lambda: kotlin.Function0): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ $receiver: GET_VAR 'a: kotlin.Any declared in .test1' type=kotlin.Any origin=PLUSEQ - lambda: BLOCK type=kotlin.Function0 origin=LAMBDA + lambda: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY @@ -32,12 +31,11 @@ FILE fqName: fileName:/lambdaInCAO.kt VAR IR_TEMPORARY_VARIABLE name:tmp0_array type:kotlin.Any [val] GET_VAR 'a: kotlin.Any declared in .test2' type=kotlin.Any origin=null VAR IR_TEMPORARY_VARIABLE name:tmp1_index0 type:kotlin.Function0 [val] - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test2' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test2' type=kotlin.Function0 origin=LAMBDA CALL 'public final fun set (index: kotlin.Function0, value: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ $receiver: GET_VAR 'val tmp0_array: kotlin.Any [val] declared in .test2' type=kotlin.Any origin=null index: GET_VAR 'val tmp1_index0: kotlin.Function0 [val] declared in .test2' type=kotlin.Function0 origin=null @@ -54,12 +52,11 @@ FILE fqName: fileName:/lambdaInCAO.kt VAR IR_TEMPORARY_VARIABLE name:tmp0_array type:kotlin.Any [val] GET_VAR 'a: kotlin.Any declared in .test3' type=kotlin.Any origin=null VAR IR_TEMPORARY_VARIABLE name:tmp1_index0 type:kotlin.Function0 [val] - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test3' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test3' type=kotlin.Function0 origin=LAMBDA VAR IR_TEMPORARY_VARIABLE name:tmp2 type:kotlin.Int [val] CALL 'public final fun get (index: kotlin.Function0): kotlin.Int declared in ' type=kotlin.Int origin=POSTFIX_INCR $receiver: GET_VAR 'val tmp0_array: kotlin.Any [val] declared in .test3' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/objectReference.txt b/compiler/testData/ir/irText/expressions/objectReference.txt index 8c1ac5f6b06..90c9af959ae 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.txt @@ -87,7 +87,7 @@ FILE fqName: fileName:/objectReference.kt PROPERTY name:aLambda visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:aLambda type:kotlin.Function0 visibility:public [final] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in .Z' type=kotlin.Unit origin=EQ @@ -101,7 +101,6 @@ FILE fqName: fileName:/objectReference.kt RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .Z.aLambda' CALL 'public final fun foo (): kotlin.Unit declared in .Z' type=kotlin.Unit origin=null $this: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Z - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .Z.aLambda' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Z) returnType:kotlin.Function0 correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.Z diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.txt b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.txt index 7a2e266d595..2ab25472e4d 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInClosureInSuperConstructorCall.txt @@ -35,12 +35,11 @@ FILE fqName: fileName:/objectReferenceInClosureInSuperConstructorCall.kt CONSTRUCTOR visibility:private <> () returnType:.Test [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor (lambda: kotlin.Function0) [primary] declared in .Base' - lambda: BLOCK type=kotlin.Function0<.Test> origin=LAMBDA + lambda: FUN_EXPR type=kotlin.Function0<.Test> FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Test BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): .Test declared in .Test.' GET_OBJECT 'CLASS OBJECT name:Test modality:FINAL visibility:public superTypes:[.Base]' type=.Test - FUNCTION_REFERENCE 'local final fun (): .Test declared in .Test.' type=kotlin.Function0<.Test> origin=LAMBDA INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Test modality:FINAL visibility:public superTypes:[.Base]' PROPERTY FAKE_OVERRIDE name:lambda visibility:public modality:FINAL [val] FIELD FAKE_OVERRIDE name:lambda type:kotlin.Function0 visibility:public [final] diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.txt index a41154b7541..ae37abbeaf2 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConstructors.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.txt @@ -3,12 +3,11 @@ FILE fqName: fileName:/samConstructors.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test1 (): java.lang.Runnable declared in ' TYPE_OP type=java.lang.Runnable origin=SAM_CONVERSION typeOperand=java.lang.Runnable - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:java.lang.Runnable VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY @@ -27,7 +26,7 @@ FILE fqName: fileName:/samConstructors.kt RETURN type=kotlin.Nothing from='public final fun test4 (): java.util.Comparator declared in ' TYPE_OP type=java.util.Comparator origin=SAM_CONVERSION typeOperand=java.util.Comparator TYPE_OP type=kotlin.Function2 origin=IMPLICIT_CAST typeOperand=kotlin.Function2 - BLOCK type=kotlin.Function2 origin=LAMBDA + FUN_EXPR type=kotlin.Function2 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (a:kotlin.Int?, b:kotlin.Int?) returnType:kotlin.Int VALUE_PARAMETER name:a index:0 type:kotlin.Int? VALUE_PARAMETER name:b index:1 type:kotlin.Int? @@ -36,4 +35,3 @@ FILE fqName: fileName:/samConstructors.kt CALL 'public final fun minus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MINUS $this: GET_VAR 'a: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null other: GET_VAR 'b: kotlin.Int? declared in .test4.' type=kotlin.Int? origin=null - FUNCTION_REFERENCE 'local final fun (a: kotlin.Int?, b: kotlin.Int?): kotlin.Int declared in .test4' type=kotlin.Function2 origin=LAMBDA diff --git a/compiler/testData/ir/irText/expressions/sam/samConversions.txt b/compiler/testData/ir/irText/expressions/sam/samConversions.txt index 9864aa7d451..9e774347f04 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversions.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversions.txt @@ -12,24 +12,22 @@ FILE fqName: fileName:/samConversions.kt BLOCK_BODY CALL 'public open fun runStatic (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' CALL 'public final fun test1 (): kotlin.Unit declared in ' type=kotlin.Unit origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN name:test2 visibility:public modality:FINAL <> ($receiver:.J) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.J BLOCK_BODY CALL 'public open fun runIt (r: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null $this: GET_VAR ': .J declared in .test2' type=.J origin=null r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test2' CALL 'public final fun test1 (): kotlin.Unit declared in ' type=kotlin.Unit origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test2' type=kotlin.Function0 origin=LAMBDA FUN name:test3 visibility:public modality:FINAL <> ($receiver:.J, a:kotlin.Function0) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.J VALUE_PARAMETER name:a index:0 type:kotlin.Function0 diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt index ff33b584cd7..913043c1375 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt @@ -3,12 +3,11 @@ FILE fqName: fileName:/variableAsFunctionCall.kt $receiver: VALUE_PARAMETER name: type:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun k (): kotlin.Function0 declared in ' - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .k' GET_VAR ': kotlin.String declared in .k' type=kotlin.String origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.String declared in .k' type=kotlin.Function0 origin=LAMBDA FUN name:test1 visibility:public modality:FINAL <> (f:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:f index:0 type:kotlin.Function0 BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.txt index 9ded1a072e5..2f6429f9003 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.txt @@ -6,12 +6,11 @@ FILE fqName: fileName:/variableAsFunctionCallWithGenerics.kt $receiver: VALUE_PARAMETER name: type:T of . BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function0.> declared in ' - BLOCK type=kotlin.Function0.> origin=LAMBDA + FUN_EXPR type=kotlin.Function0.> FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of . BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): T of . declared in .' GET_VAR ': T of . declared in .' type=T of . origin=null - FUNCTION_REFERENCE 'local final fun (): T of . declared in .' type=kotlin.Function0.> origin=LAMBDA FUN name:testGeneric1 visibility:public modality:FINAL <> (x:kotlin.String) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.String BLOCK_BODY @@ -27,12 +26,11 @@ FILE fqName: fileName:/variableAsFunctionCallWithGenerics.kt $receiver: VALUE_PARAMETER name: type:T of . BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function0.> declared in ' - BLOCK type=kotlin.Function0.> origin=ANONYMOUS_FUNCTION + FUN_EXPR type=kotlin.Function0.> FUN name: visibility:local modality:FINAL <> () returnType:T of . BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): T of . declared in .' GET_VAR ': T of . declared in .' type=T of . origin=null - FUNCTION_REFERENCE 'local final fun (): T of . declared in .' type=kotlin.Function0.> origin=ANONYMOUS_FUNCTION FUN name:kt26531 visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun kt26531 (): kotlin.Int declared in ' diff --git a/compiler/testData/ir/irText/lambdas/anonymousFunction.txt b/compiler/testData/ir/irText/lambdas/anonymousFunction.txt index 33eb6cfdcdf..d40d3475d0c 100644 --- a/compiler/testData/ir/irText/lambdas/anonymousFunction.txt +++ b/compiler/testData/ir/irText/lambdas/anonymousFunction.txt @@ -2,11 +2,10 @@ FILE fqName: fileName:/anonymousFunction.kt PROPERTY name:anonymous visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:anonymous type:kotlin.Function0 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=ANONYMOUS_FUNCTION + FUN_EXPR type=kotlin.Function0 FUN name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun println (): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .anonymous' type=kotlin.Function0 origin=ANONYMOUS_FUNCTION FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function0 correspondingProperty: PROPERTY name:anonymous visibility:public modality:FINAL [val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt index 5f9c581279c..788a88138aa 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt @@ -140,7 +140,7 @@ FILE fqName: fileName:/destructuringInLambda.kt PROPERTY name:fn visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:fn type:kotlin.Function1<.A, kotlin.Int> visibility:public [static] EXPRESSION_BODY - BLOCK type=kotlin.Function1<.A, kotlin.Int> origin=LAMBDA + FUN_EXPR type=kotlin.Function1<.A, kotlin.Int> FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (:.A) returnType:kotlin.Int VALUE_PARAMETER name: index:0 type:.A BLOCK_BODY @@ -151,7 +151,6 @@ FILE fqName: fileName:/destructuringInLambda.kt CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=PLUS $this: CONST Int type=kotlin.Int value=42 other: GET_VAR 'val y: kotlin.Int [val] declared in .fn.' type=kotlin.Int origin=null - FUNCTION_REFERENCE 'local final fun (: .A): kotlin.Int declared in .fn' type=kotlin.Function1<.A, kotlin.Int> origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function1<.A, kotlin.Int> correspondingProperty: PROPERTY name:fn visibility:public modality:FINAL [var] BLOCK_BODY diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.txt index 08b8cb52ee6..c848f037717 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.txt @@ -6,11 +6,10 @@ FILE fqName: fileName:/extensionLambda.kt : kotlin.String : kotlin.Int $receiver: CONST String type=kotlin.String value="42" - block: BLOCK type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 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 RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': kotlin.String declared in .test1.' type=kotlin.String origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test1' type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA diff --git a/compiler/testData/ir/irText/lambdas/justLambda.txt b/compiler/testData/ir/irText/lambdas/justLambda.txt index c82bdb8205a..bd931299ede 100644 --- a/compiler/testData/ir/irText/lambdas/justLambda.txt +++ b/compiler/testData/ir/irText/lambdas/justLambda.txt @@ -2,12 +2,11 @@ FILE fqName: fileName:/justLambda.kt PROPERTY name:test1 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Function0 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' CONST Int type=kotlin.Int value=42 - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function0 correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val] BLOCK_BODY @@ -16,12 +15,11 @@ FILE fqName: fileName:/justLambda.kt PROPERTY name:test2 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Function0 visibility:public [final,static] EXPRESSION_BODY - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test2' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test2' type=kotlin.Function0 origin=LAMBDA FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Function0 correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index 4a81f8258c9..2282ce1d7c8 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -90,7 +90,7 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt : .A : kotlin.Int receiver: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.A - block: BLOCK type=@[ExtensionFunctionType] kotlin.Function1<.A, kotlin.Int> origin=LAMBDA + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.A, 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 @@ -99,7 +99,7 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt : .IFoo : kotlin.Int receiver: GET_VAR 'fooImpl: .IFoo declared in .test' type=.IFoo origin=null - block: BLOCK type=@[ExtensionFunctionType] kotlin.Function1<.IFoo, kotlin.Int> origin=LAMBDA + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.IFoo, 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 @@ -108,7 +108,7 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt : .IInvoke : kotlin.Int receiver: GET_VAR 'invokeImpl: .IInvoke declared in .test' type=.IInvoke origin=null - block: BLOCK type=@[ExtensionFunctionType] kotlin.Function1<.IInvoke, kotlin.Int> origin=LAMBDA + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.IInvoke, 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 @@ -118,6 +118,3 @@ FILE fqName: fileName:/multipleImplicitReceivers.kt $receiver: CALL 'public open fun (): .B declared in .IFoo' type=.B origin=GET_PROPERTY $this: GET_VAR ': .IFoo declared in .test..' type=.IFoo origin=null $receiver: GET_VAR ': .A declared in .test.' type=.A origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test..' type=@[ExtensionFunctionType] kotlin.Function1<.IInvoke, kotlin.Int> origin=LAMBDA - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test.' type=@[ExtensionFunctionType] kotlin.Function1<.IFoo, kotlin.Int> origin=LAMBDA - FUNCTION_REFERENCE 'local final fun (): kotlin.Int declared in .test' type=@[ExtensionFunctionType] kotlin.Function1<.A, kotlin.Int> origin=LAMBDA diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt index 4a36c4b3712..74a11f17c18 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt @@ -3,56 +3,51 @@ FILE fqName: fileName:/nonLocalReturn.kt BLOCK_BODY CALL 'public final fun run (block: kotlin.Function0): R of kotlin.run [inline] declared in kotlin' type=kotlin.Nothing origin=null : kotlin.Nothing - block: BLOCK type=kotlin.Function0 origin=LAMBDA + block: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test0 (): kotlin.Unit declared in ' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Nothing declared in .test0' type=kotlin.Function0 origin=LAMBDA FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun run (block: kotlin.Function0): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null : kotlin.Unit - block: BLOCK type=kotlin.Function0 origin=LAMBDA + block: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun run (block: kotlin.Function0): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null : kotlin.Unit - block: BLOCK type=kotlin.Function0 origin=LAMBDA + block: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test2' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test2' type=kotlin.Function0 origin=LAMBDA FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY CALL 'public final fun run (block: kotlin.Function0): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null : kotlin.Unit - block: BLOCK type=kotlin.Function0 origin=LAMBDA + block: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test3' CALL 'public final fun run (block: kotlin.Function0): R of kotlin.run [inline] declared in kotlin' type=kotlin.Nothing origin=null : kotlin.Nothing - block: BLOCK type=kotlin.Function0 origin=LAMBDA + block: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test3' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - FUNCTION_REFERENCE 'local final fun (): kotlin.Nothing declared in .test3.' type=kotlin.Function0 origin=LAMBDA - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test3' type=kotlin.Function0 origin=LAMBDA FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List BLOCK_BODY CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null : kotlin.Int $receiver: GET_VAR 'ints: kotlin.collections.List declared in .testLrmFoo1' type=kotlin.collections.List origin=null - action: BLOCK type=kotlin.Function1 origin=LAMBDA + action: FUN_EXPR type=kotlin.Function1 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY @@ -66,14 +61,13 @@ FILE fqName: fileName:/nonLocalReturn.kt RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo1' CALL 'public final fun print (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: GET_VAR 'it: kotlin.Int declared in .testLrmFoo1.' type=kotlin.Int origin=null - FUNCTION_REFERENCE 'local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo1' type=kotlin.Function1 origin=LAMBDA FUN name:testLrmFoo2 visibility:public modality:FINAL <> (ints:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List BLOCK_BODY CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null : kotlin.Int $receiver: GET_VAR 'ints: kotlin.collections.List declared in .testLrmFoo2' type=kotlin.collections.List origin=null - action: BLOCK type=kotlin.Function1 origin=LAMBDA + action: FUN_EXPR type=kotlin.Function1 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY @@ -87,4 +81,3 @@ FILE fqName: fileName:/nonLocalReturn.kt RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo2' CALL 'public final fun print (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: GET_VAR 'it: kotlin.Int declared in .testLrmFoo2.' type=kotlin.Int origin=null - FUNCTION_REFERENCE 'local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo2' type=kotlin.Function1 origin=LAMBDA diff --git a/compiler/testData/ir/irText/lambdas/samAdapter.txt b/compiler/testData/ir/irText/lambdas/samAdapter.txt index 63a6ff93f3d..70b5d748702 100644 --- a/compiler/testData/ir/irText/lambdas/samAdapter.txt +++ b/compiler/testData/ir/irText/lambdas/samAdapter.txt @@ -3,12 +3,11 @@ FILE fqName: fileName:/samAdapter.kt BLOCK_BODY VAR name:hello type:java.lang.Runnable [val] TYPE_OP type=java.lang.Runnable origin=SAM_CONVERSION typeOperand=java.lang.Runnable - BLOCK type=kotlin.Function0 origin=LAMBDA + FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test1' CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value="Hello, world!" - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .test1' type=kotlin.Function0 origin=LAMBDA CALL 'public abstract fun run (): kotlin.Unit declared in java.lang.Runnable' type=kotlin.Unit origin=null $this: GET_VAR 'val hello: java.lang.Runnable [val] declared in .test1' type=java.lang.Runnable origin=null diff --git a/compiler/testData/ir/irText/stubs/builtinMap.txt b/compiler/testData/ir/irText/stubs/builtinMap.txt index 00e8ec9e2d9..0db37e2c273 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.txt @@ -22,7 +22,7 @@ FILE fqName: fileName:/builtinMap.kt : K1 of .plus? : 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: BLOCK type=@[ExtensionFunctionType] kotlin.Function1.plus?, V1 of .plus?>, kotlin.Unit> origin=LAMBDA + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1.plus?, V1 of .plus?>, 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 @@ -34,4 +34,3 @@ FILE fqName: fileName:/builtinMap.kt $this: GET_VAR 'pair: kotlin.Pair.plus, V1 of .plus> declared in .plus' type=kotlin.Pair.plus, V1 of .plus> origin=null value: CALL 'public final fun (): B of kotlin.Pair declared in kotlin.Pair' type=V1 of .plus origin=GET_PROPERTY $this: GET_VAR 'pair: kotlin.Pair.plus, V1 of .plus> declared in .plus' type=kotlin.Pair.plus, V1 of .plus> origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Unit declared in .plus' type=@[ExtensionFunctionType] kotlin.Function1.plus?, V1 of .plus?>, kotlin.Unit> origin=LAMBDA diff --git a/compiler/testData/ir/irText/types/intersectionType2_NI.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.txt index e4b0ec3bdb7..783b70f1129 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_NI.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.txt @@ -86,7 +86,7 @@ FILE fqName: fileName:/intersectionType2_NI.kt RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in ' CALL 'public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' type=kotlin.Any origin=null : kotlin.Any - fn: BLOCK type=kotlin.Function0 origin=LAMBDA + fn: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any BLOCK_BODY VAR name:mm type:.B [val] @@ -103,4 +103,3 @@ FILE fqName: fileName:/intersectionType2_NI.kt then: GET_VAR 'val nn: .C [val] declared in .foo.' type=.C origin=null RETURN type=kotlin.Nothing from='local final fun (): kotlin.Any declared in .foo' GET_VAR 'val c: kotlin.Any [val] declared in .foo.' type=kotlin.Any origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Any declared in .foo' type=kotlin.Function0 origin=LAMBDA diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.txt index af12abf7316..da9b9d81cc5 100644 --- a/compiler/testData/ir/irText/types/intersectionType2_OI.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.txt @@ -86,7 +86,7 @@ FILE fqName: fileName:/intersectionType2_OI.kt RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in ' CALL 'public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' type=kotlin.Any origin=null : kotlin.Any - fn: BLOCK type=kotlin.Function0 origin=LAMBDA + fn: FUN_EXPR type=kotlin.Function0 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any BLOCK_BODY VAR name:mm type:.B [val] @@ -103,4 +103,3 @@ FILE fqName: fileName:/intersectionType2_OI.kt then: GET_VAR 'val nn: .C [val] declared in .foo.' type=.C origin=null RETURN type=kotlin.Nothing from='local final fun (): kotlin.Any declared in .foo' GET_VAR 'val c: kotlin.Any [val] declared in .foo.' type=kotlin.Any origin=null - FUNCTION_REFERENCE 'local final fun (): kotlin.Any declared in .foo' type=kotlin.Function0 origin=LAMBDA