From 0d2552b0b64404cbb90dbabacee4df127bb826fc Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Fri, 5 Jun 2020 15:00:03 -0700 Subject: [PATCH] FIR: record and serialize the modifier "fun" for functional interface --- .../fir/serialization/FirElementSerializer.kt | 2 +- .../fir/backend/Fir2IrClassifierStorage.kt | 2 +- .../converter/DeclarationsConverter.kt | 1 + .../fir/lightTree/fir/modifier/Modifier.kt | 4 + .../fir/modifier/ModifiersEnumSet.kt | 3 +- .../kotlin/fir/builder/RawFirBuilder.kt | 1 + .../fir/declarations/FirDeclarationStatus.kt | 1 + .../FirResolvedDeclarationStatus.kt | 1 + .../fir/declarations/FirDeclarationUtil.kt | 1 + .../impl/FirDeclarationStatusImpl.kt | 9 +- .../fir/tree/generator/NodeConfigurator.kt | 2 +- .../box/reflection/modifiers/classes.kt | 1 - .../caoWithAdaptationForSam.fir.txt | 4 +- .../withAdaptationForSam.fir.txt | 2 +- .../arrayAsVarargAfterSamArgument_fi.fir.txt | 147 ------------------ .../arrayAsVarargAfterSamArgument_fi.kt | 1 + .../basicFunInterfaceConversion.fir.txt | 34 ---- .../basicFunInterfaceConversion.kt | 1 + .../funInterface/castFromAny.fir.txt | 2 +- .../funInterface/partialSam.fir.txt | 2 +- .../samConversionInVarargs.fir.txt | 2 +- .../samConversionInVarargsMixed.fir.txt | 2 +- .../samConversionOnCallableReference.fir.txt | 2 +- .../samConversionsWithSmartCasts.fir.txt | 2 +- 24 files changed, 33 insertions(+), 196 deletions(-) delete mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt delete mode 100644 compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.fir.txt diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index b2af9a9d767..595ac8aefce 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -98,7 +98,7 @@ class FirElementSerializer private constructor( regularClass?.isExternal == true, regularClass?.isExpect == true, regularClass?.isInline == true, - false // TODO: klass.isFun not supported yet + regularClass?.isFun == true ) if (flags != builder.flags) { builder.flags = flags diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt index 3ebb347efec..285e76cc108 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt @@ -183,7 +183,7 @@ class Fir2IrClassifierStorage( isExternal = regularClass.isExternal, isInline = regularClass.isInline, isExpect = regularClass.isExpect, - isFun = false // TODO FirRegularClass.isFun + isFun = regularClass.isFun ).apply { metadata = FirMetadataSource.Class(regularClass, descriptor) descriptor.bind(this) diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index 9ddc3b32555..2ff6c5d4a9a 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -382,6 +382,7 @@ class DeclarationsConverter( isCompanion = modifiers.isCompanion() && classKind == ClassKind.OBJECT isData = modifiers.isDataClass() isInline = modifiers.isInlineClass() + isFun = modifiers.isFunctionalInterface() } buildRegularClass { diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/Modifier.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/Modifier.kt index fc2bc97c9bf..8a85f4ec419 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/Modifier.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/Modifier.kt @@ -78,6 +78,10 @@ class Modifier( return classModifiers.contains(ClassModifier.COMPANION) } + fun isFunctionalInterface(): Boolean { + return classModifiers.contains(ClassModifier.FUN) + } + fun hasOverride(): Boolean { return memberModifiers.contains(MemberModifier.OVERRIDE) } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/ModifiersEnumSet.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/ModifiersEnumSet.kt index ac93c08fd0f..779d27566d0 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/ModifiersEnumSet.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/ModifiersEnumSet.kt @@ -11,7 +11,8 @@ enum class ClassModifier { DATA, INLINE, INNER, - COMPANION + COMPANION, + FUN } enum class MemberModifier { diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index d64e38f7112..3892c8b0c0f 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -670,6 +670,7 @@ class RawFirBuilder( isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true isData = classOrObject.hasModifier(DATA_KEYWORD) isInline = classOrObject.hasModifier(INLINE_KEYWORD) + isFun = classOrObject.hasModifier(FUN_KEYWORD) } withCapturedTypeParameters { if (!status.isInner) context.capturedTypeParameters = context.capturedTypeParameters.clear() diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirDeclarationStatus.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirDeclarationStatus.kt index 8de4aeed087..1cf207ac1e3 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirDeclarationStatus.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirDeclarationStatus.kt @@ -39,6 +39,7 @@ interface FirDeclarationStatus : FirElement { val isStatic: Boolean val isFromSealedClass: Boolean val isFromEnumClass: Boolean + val isFun: Boolean override fun accept(visitor: FirVisitor, data: D): R = visitor.visitDeclarationStatus(this, data) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirResolvedDeclarationStatus.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirResolvedDeclarationStatus.kt index 63032a8c9d6..b3ee0ba58eb 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirResolvedDeclarationStatus.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirResolvedDeclarationStatus.kt @@ -38,6 +38,7 @@ interface FirResolvedDeclarationStatus : FirDeclarationStatus { override val isStatic: Boolean override val isFromSealedClass: Boolean override val isFromEnumClass: Boolean + override val isFun: Boolean override fun accept(visitor: FirVisitor, data: D): R = visitor.visitResolvedDeclarationStatus(this, data) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt index 3d65032caff..22e6f83ea5e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt @@ -37,6 +37,7 @@ inline val FirRegularClass.isInner get() = status.isInner inline val FirRegularClass.isCompanion get() = status.isCompanion inline val FirRegularClass.isData get() = status.isData inline val FirRegularClass.isInline get() = status.isInline +inline val FirRegularClass.isFun get() = status.isFun inline val FirMemberDeclaration.modality get() = status.modality inline val FirMemberDeclaration.visibility get() = status.visibility inline val FirMemberDeclaration.allowsToHaveFakeOverride: Boolean diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDeclarationStatusImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDeclarationStatusImpl.kt index 7a801152b46..f39a80ca925 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDeclarationStatusImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDeclarationStatusImpl.kt @@ -136,6 +136,12 @@ open class FirDeclarationStatusImpl( this[FROM_ENUM] = value } + override var isFun: Boolean + get() = this[FUN] + set(value) { + this[FUN] = value + } + private enum class Modifier(val mask: Int) { EXPECT(0x1), ACTUAL(0x2), @@ -153,7 +159,8 @@ open class FirDeclarationStatusImpl( SUSPEND(0x2000), STATIC(0x4000), FROM_SEALED(0x8000), - FROM_ENUM(0x10000) + FROM_ENUM(0x10000), + FUN(0x20000) } override fun acceptChildren(visitor: FirVisitor, data: D) {} diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt index 73f16e69208..7203617f39d 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt @@ -323,7 +323,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild generateBooleanFields( "expect", "actual", "override", "operator", "infix", "inline", "tailRec", "external", "const", "lateInit", "inner", "companion", "data", "suspend", "static", - "fromSealedClass", "fromEnumClass" + "fromSealedClass", "fromEnumClass", "fun" ) } diff --git a/compiler/testData/codegen/box/reflection/modifiers/classes.kt b/compiler/testData/codegen/box/reflection/modifiers/classes.kt index 635addea422..1fbc26de0da 100644 --- a/compiler/testData/codegen/box/reflection/modifiers/classes.kt +++ b/compiler/testData/codegen/box/reflection/modifiers/classes.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR // WITH_REFLECT // FILE: box.kt diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt index 46f24184f1b..d0e87f7db6c 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/caoWithAdaptationForSam.kt - CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo FUN name:foo visibility:public modality:ABSTRACT <> ($this:.IFoo, i:kotlin.Int) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.IFoo @@ -17,7 +17,7 @@ FILE fqName: fileName:/caoWithAdaptationForSam.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS INTERFACE name:IFoo2 modality:ABSTRACT visibility:public superTypes:[.IFoo] + CLASS INTERFACE name:IFoo2 modality:ABSTRACT visibility:public [fun] superTypes:[.IFoo] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo2 FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:.IFoo, i:kotlin.Int) returnType:kotlin.Unit [fake_override] overridden: diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.txt index 96b5122a665..23e2f715fd3 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withAdaptationForSam.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/withAdaptationForSam.kt - CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo FUN name:foo visibility:public modality:ABSTRACT <> ($this:.IFoo, i:kotlin.Int) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.IFoo diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt deleted file mode 100644 index beb3175f117..00000000000 --- a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt +++ /dev/null @@ -1,147 +0,0 @@ -FILE fqName: fileName:/arrayAsVarargAfterSamArgument_fi.kt - CLASS INTERFACE name:IRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IRunnable - FUN name:run visibility:public modality:ABSTRACT <> ($this:.IRunnable) returnType:kotlin.Unit - $this: VALUE_PARAMETER name: type:.IRunnable - 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:foo1 visibility:public modality:FINAL <> (r:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit - VALUE_PARAMETER name:r index:0 type:.IRunnable - VALUE_PARAMETER name:s index:1 type:kotlin.Array varargElementType:kotlin.String [vararg] - BLOCK_BODY - FUN name:foo2 visibility:public modality:FINAL <> (r1:.IRunnable, r2:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit - VALUE_PARAMETER name:r1 index:0 type:.IRunnable - VALUE_PARAMETER name:r2 index:1 type:.IRunnable - VALUE_PARAMETER name:s index:2 type:kotlin.Array varargElementType:kotlin.String [vararg] - BLOCK_BODY - FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0, r:.IRunnable, s:kotlin.String, arr:kotlin.Array) returnType:kotlin.Unit - VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 - VALUE_PARAMETER name:r index:1 type:.IRunnable - VALUE_PARAMETER name:s index:2 type:kotlin.String - VALUE_PARAMETER name:arr index:3 type:kotlin.Array - BLOCK_BODY - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null - CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null - r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null - r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - s: VARARG type=kotlin.Array varargElementType=kotlin.String - SPREAD_ELEMENT - GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt index b41780765f7..d20401c07f4 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions fun interface IRunnable { diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.fir.txt deleted file mode 100644 index 4a72567999d..00000000000 --- a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.fir.txt +++ /dev/null @@ -1,34 +0,0 @@ -FILE fqName: fileName:/basicFunInterfaceConversion.kt - CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo - FUN name:invoke visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:kotlin.String - $this: VALUE_PARAMETER name: type:.Foo - 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 <> (f:.Foo) returnType:kotlin.String - VALUE_PARAMETER name:f index:0 type:.Foo - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun foo (f: .Foo): kotlin.String declared in ' - CALL 'public abstract fun invoke (): kotlin.String declared in .Foo' type=kotlin.String origin=null - $this: GET_VAR 'f: .Foo declared in .foo' type=.Foo origin=null - FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test (): kotlin.String declared in ' - CALL 'public final fun foo (f: .Foo): kotlin.String declared in ' type=kotlin.String origin=null - f: TYPE_OP type=.Foo origin=SAM_CONVERSION typeOperand=.Foo - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - 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 .test' - CONST String type=kotlin.String value="OK" diff --git a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt index 94f6bbcebbd..1aee6958341 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt +++ b/compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions fun interface Foo { diff --git a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.fir.txt index 1d208b44f29..a95d76ae11a 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/castFromAny.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/castFromAny.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/castFromAny.kt - CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.KRunnable FUN name:invoke visibility:public modality:ABSTRACT <> ($this:.KRunnable) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.KRunnable diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt index b439e09d60a..178e359f178 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/partialSam.kt - CLASS INTERFACE name:Fn modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:Fn modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fn.Fn, R of .Fn> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] TYPE_PARAMETER name:R index:1 variance: superTypes:[kotlin.Any?] diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.txt index 71381543462..3fa5d7cbf61 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargs.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/samConversionInVarargs.kt - CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo FUN name:foo visibility:public modality:ABSTRACT <> ($this:.IFoo, i:kotlin.Int) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.IFoo diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.txt index 6e37891949c..4aa43a25cad 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionInVarargsMixed.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/samConversionInVarargsMixed.kt - CLASS INTERFACE name:MyRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:MyRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyRunnable FUN name:run visibility:public modality:ABSTRACT <> ($this:.MyRunnable) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.MyRunnable diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt index 5d01d1cb5fc..4db54cb0622 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionOnCallableReference.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/samConversionOnCallableReference.kt - CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.KRunnable FUN name:run visibility:public modality:ABSTRACT <> ($this:.KRunnable) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.KRunnable diff --git a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt index 6664533d3c8..2e97ae159d3 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.fir.txt @@ -1,5 +1,5 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt - CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.KRunnable FUN name:run visibility:public modality:ABSTRACT <> ($this:.KRunnable) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.KRunnable