diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 671b45acf94..e77bff15920 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -316,8 +316,9 @@ class Fir2IrDeclarationStorage( val result = anonymousObject.convertWithOffsets { startOffset, endOffset -> irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality, visibility) { symbol -> IrClassImpl( - startOffset, endOffset, origin, symbol, - name, anonymousObject.classKind, + startOffset, endOffset, origin, symbol, name, + // NB: for unknown reason, IR uses 'CLASS' kind for simple anonymous objects + anonymousObject.classKind.takeIf { it == ClassKind.ENUM_ENTRY } ?: ClassKind.CLASS, visibility, modality, isCompanion = false, isInner = false, isData = false, isExternal = false, isInline = false, isExpect = false, isFun = false diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt index 2d4d2678b98..01d25f38c50 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt @@ -104,12 +104,12 @@ FILE fqName: fileName:/delegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun otherImpl (x0: kotlin.String, y0: kotlin.Int): .IOther declared in ' BLOCK type=.otherImpl. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.IOther] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.IOther] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.otherImpl. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.IOther]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.IOther]' PROPERTY name:x visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private [final] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt index b176edfc3be..0edd7e12fe3 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt @@ -56,12 +56,12 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt VALUE_PARAMETER name:x index:0 type:kotlin.Any EXPRESSION_BODY BLOCK type=.B.. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B.. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any]' CONSTRUCTOR_CALL 'private constructor () [primary] declared in .B..' type=.B.. origin=null BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.txt index 4f342747c4b..c5b9bd4e0d2 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.fir.txt @@ -20,12 +20,12 @@ FILE fqName: fileName:/objectLiteralExpressions.kt FIELD PROPERTY_BACKING_FIELD name:test1 type:.test1. visibility:private [final,static] EXPRESSION_BODY BLOCK type=.test1. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test1. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any]' CONSTRUCTOR_CALL 'private constructor () [primary] declared in .test1.' type=.test1. origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:.test1. correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val] @@ -36,12 +36,12 @@ FILE fqName: fileName:/objectLiteralExpressions.kt FIELD PROPERTY_BACKING_FIELD name:test2 type:.test2. visibility:private [final,static] EXPRESSION_BODY BLOCK type=.test2. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.IFoo] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.IFoo] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test2. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.IFoo]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.IFoo]' FUN name:foo visibility:public modality:FINAL <> ($this:.test2.) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.test2. BLOCK_BODY @@ -87,12 +87,12 @@ FILE fqName: fileName:/objectLiteralExpressions.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test3 (): .Outer.test3. declared in .Outer' BLOCK type=.Outer.test3. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer.test3. CONSTRUCTOR visibility:private <> () returnType:.Outer.Inner [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Outer.Inner' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' FUN name:foo visibility:public modality:FINAL <> ($this:.Outer.test3.) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Outer.test3. BLOCK_BODY @@ -117,12 +117,12 @@ FILE fqName: fileName:/objectLiteralExpressions.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test4 (): .test4. declared in ' BLOCK type=.test4. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test4. CONSTRUCTOR visibility:private <> () returnType:.Outer.Inner [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Outer.Inner' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' FUN name:foo visibility:public modality:FINAL <> ($this:.test4.) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.test4. BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt index 9d0e2c6312f..400f6118306 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt @@ -67,12 +67,12 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt FIELD PROPERTY_BACKING_FIELD name:anObject type:.MyEnum.Z.anObject. visibility:private [final] EXPRESSION_BODY BLOCK type=.MyEnum.Z.anObject. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.Z.anObject. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any]' ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt index 351ad3d65b9..b67d244f34e 100644 --- a/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt +++ b/compiler/testData/ir/irText/expressions/funInterface/partialSam.fir.txt @@ -59,12 +59,12 @@ FILE fqName: fileName:/partialSam.kt FIELD PROPERTY_BACKING_FIELD name:fsi type:.fsi. visibility:private [final,static] EXPRESSION_BODY BLOCK type=.fsi. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Fn] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Fn] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.fsi. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Fn]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Fn]' FUN name:run visibility:public modality:FINAL <> ($this:.fsi., s:kotlin.String, i:kotlin.Int, t:kotlin.String) returnType:kotlin.Int $this: VALUE_PARAMETER name: type:.fsi. VALUE_PARAMETER name:s index:0 type:kotlin.String @@ -83,12 +83,12 @@ FILE fqName: fileName:/partialSam.kt FIELD PROPERTY_BACKING_FIELD name:fis type:.fis. visibility:private [final,static] EXPRESSION_BODY BLOCK type=.fis. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Fn] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Fn] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.fis. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Fn]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Fn]' FUN name:run visibility:public modality:FINAL <> ($this:.fis., s:kotlin.String, i:kotlin.Int, t:kotlin.Int) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.fis. VALUE_PARAMETER name:s index:0 type:kotlin.String diff --git a/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.txt b/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.txt index c0b60c0cba8..3ba32372d9f 100644 --- a/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.txt +++ b/compiler/testData/ir/irText/expressions/multipleThisReferences.fir.txt @@ -73,13 +73,13 @@ FILE fqName: fileName:/multipleThisReferences.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test (): .Host.test. declared in .Host' BLOCK type=.Host.test. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host.test. CONSTRUCTOR visibility:private <> () returnType:.Outer.Inner [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int) [primary] declared in .Outer.Inner' x: CONST Int type=kotlin.Int value=42 - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' PROPERTY name:xx visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/expressions/objectReference.fir.txt b/compiler/testData/ir/irText/expressions/objectReference.fir.txt index 7f04133dfe8..0f9b39557ee 100644 --- a/compiler/testData/ir/irText/expressions/objectReference.fir.txt +++ b/compiler/testData/ir/irText/expressions/objectReference.fir.txt @@ -111,12 +111,12 @@ FILE fqName: fileName:/objectReference.kt FIELD PROPERTY_BACKING_FIELD name:anObject type:.Z.anObject. visibility:private [final] EXPRESSION_BODY BLOCK type=.Z.anObject. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z.anObject. CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[kotlin.Any]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.Any]' ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.txt b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.txt index f61f25b005f..d733ac164a9 100644 --- a/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.txt +++ b/compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.fir.txt @@ -67,13 +67,13 @@ FILE fqName: fileName:/thisOfGenericOuterClass.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test (): .test. declared in ' BLOCK type=.test. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test. CONSTRUCTOR visibility:private <> () returnType:.Outer.Inner [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor (y: kotlin.Int) [primary] declared in .Outer.Inner' y: CONST Int type=kotlin.Int value=42 - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Outer.Inner]' PROPERTY name:xx visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.txt b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.txt index 7f9006068df..40ddb9c4dd6 100644 --- a/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.txt +++ b/compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.fir.txt @@ -4,22 +4,22 @@ FILE fqName: fileName:/thisReferenceBeforeClassDeclared.kt BLOCK_BODY VAR name:test1 type:.test. [val] BLOCK type=.test. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.WithCompanion] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.WithCompanion] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test. CONSTRUCTOR visibility:private <> () returnType:.WithCompanion [primary] BLOCK_BODY ERROR_CALL 'Cannot find delegated constructor call' type=.WithCompanion - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.WithCompanion]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.WithCompanion]' CONSTRUCTOR_CALL 'private constructor () [primary] declared in .test.' type=.test. origin=null VAR name:test2 type:.test. [val] BLOCK type=.test. origin=OBJECT_LITERAL - CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.WithCompanion] + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.WithCompanion] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.test. CONSTRUCTOR visibility:private <> () returnType:.WithCompanion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor (a: .WithCompanion.Companion) [primary] declared in .WithCompanion' a: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name: modality:FINAL visibility:local superTypes:[.WithCompanion]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.WithCompanion]' CONSTRUCTOR_CALL 'private constructor () [primary] declared in .test.' type=.test. origin=null CLASS CLASS name:WithCompanion modality:OPEN visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.WithCompanion