From 9a0e7637611637bcce1da094f03e85b38079a37b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 24 Jun 2020 13:06:03 +0300 Subject: [PATCH] [FIR2IR] Require classId from parent class for fake overrides --- .../generators/FakeOverrideGenerator.kt | 24 ++++++----- .../testData/ir/irText/classes/enum.fir.txt | 40 +++++++++---------- .../irText/classes/enumClassModality.fir.txt | 20 +++++----- .../classes/enumWithMultipleCtors.fir.txt | 12 +++--- .../classes/enumWithSecondaryCtor.fir.txt | 20 +++++----- .../enumEntriesWithAnnotations.fir.txt | 8 ++-- .../expressions/enumEntryAsReceiver.fir.txt | 4 +- ...umEntryReferenceFromEnumEntryClass.fir.txt | 4 +- .../temporaryInEnumEntryInitializer.fir.txt | 4 +- .../ir/irText/singletons/enumEntry.fir.txt | 4 +- 10 files changed, 72 insertions(+), 68 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt index 9a5b51b33d8..6a2ecf3ba44 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt @@ -74,9 +74,11 @@ class FakeOverrideGenerator( return@processFunctionsByName } val origin = IrDeclarationOrigin.FAKE_OVERRIDE - if (functionSymbol.isFakeOverride) { + val baseSymbol = functionSymbol.deepestOverriddenSymbol() as FirNamedFunctionSymbol + if (functionSymbol.isFakeOverride && + (functionSymbol.callableId.classId == klass.symbol.classId || fakeOverrideMode == FakeOverrideMode.SUBSTITUTION) + ) { // Substitution case - val baseSymbol = functionSymbol.deepestOverriddenSymbol() as FirNamedFunctionSymbol val irFunction = declarationStorage.createIrFunction( originalFunction, irParent = this, thisReceiverOwner = declarationStorage.findIrParent(baseSymbol.fir) as? IrClass, @@ -93,7 +95,7 @@ class FakeOverrideGenerator( } else if (fakeOverrideMode != FakeOverrideMode.SUBSTITUTION && originalFunction.allowsToHaveFakeOverrideIn(klass)) { // Trivial fake override case val fakeOverrideSymbol = FirClassSubstitutionScope.createFakeOverrideFunction( - session, originalFunction, functionSymbol, derivedClassId = klass.symbol.classId + session, originalFunction, baseSymbol, derivedClassId = klass.symbol.classId ) val fakeOverrideFunction = fakeOverrideSymbol.fir @@ -106,7 +108,7 @@ class FakeOverrideGenerator( if (irFunction.returnType.containsErrorType() || irFunction.valueParameters.any { it.type.containsErrorType() }) { return@processFunctionsByName } - val overriddenSymbol = declarationStorage.getIrFunctionSymbol(functionSymbol) as IrSimpleFunctionSymbol + val overriddenSymbol = declarationStorage.getIrFunctionSymbol(baseSymbol) as IrSimpleFunctionSymbol irFunction.parent = this result += irFunction.withFunction { overriddenSymbols = listOf(overriddenSymbol) @@ -118,9 +120,11 @@ class FakeOverrideGenerator( if (propertySymbol is FirPropertySymbol) { val originalProperty = propertySymbol.fir val origin = IrDeclarationOrigin.FAKE_OVERRIDE - if (propertySymbol.isFakeOverride) { + val baseSymbol = propertySymbol.deepestOverriddenSymbol() as FirPropertySymbol + if (propertySymbol.isFakeOverride && + (propertySymbol.callableId.classId == klass.symbol.classId || fakeOverrideMode == FakeOverrideMode.SUBSTITUTION) + ) { // Substitution case - val baseSymbol = propertySymbol.deepestOverriddenSymbol() as FirPropertySymbol val irProperty = declarationStorage.createIrProperty( originalProperty, irParent = this, thisReceiverOwner = declarationStorage.findIrParent(baseSymbol.fir) as? IrClass, @@ -133,7 +137,7 @@ class FakeOverrideGenerator( } else if (fakeOverrideMode != FakeOverrideMode.SUBSTITUTION && originalProperty.allowsToHaveFakeOverrideIn(klass)) { // Trivial fake override case val fakeOverrideSymbol = FirClassSubstitutionScope.createFakeOverrideProperty( - session, originalProperty, propertySymbol, derivedClassId = klass.symbol.classId + session, originalProperty, baseSymbol, derivedClassId = klass.symbol.classId ) val fakeOverrideProperty = fakeOverrideSymbol.fir @@ -144,10 +148,10 @@ class FakeOverrideGenerator( origin = origin ).apply { // Do not create fake overrides for accessors if not allowed to do so, e.g., private lateinit var. - if (originalProperty.getter?.allowsToHaveFakeOverride != true) { + if (baseSymbol.fir.getter?.allowsToHaveFakeOverride != true) { getter = null } - if (originalProperty.setter?.allowsToHaveFakeOverride != true) { + if (baseSymbol.fir.setter?.allowsToHaveFakeOverride != true) { setter = null } } @@ -158,7 +162,7 @@ class FakeOverrideGenerator( } irProperty.parent = this result += irProperty.withProperty { - setOverriddenSymbolsForAccessors(declarationStorage, fakeOverrideProperty, firOverriddenSymbol = propertySymbol) + setOverriddenSymbolsForAccessors(declarationStorage, fakeOverrideProperty, firOverriddenSymbol = baseSymbol) } } } diff --git a/compiler/testData/ir/irText/classes/enum.fir.txt b/compiler/testData/ir/irText/classes/enum.fir.txt index 5facc0c4091..bff1d9cc992 100644 --- a/compiler/testData/ir/irText/classes/enum.fir.txt +++ b/compiler/testData/ir/irText/classes/enum.fir.txt @@ -90,10 +90,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum2, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum2 VALUE_PARAMETER name:other index:0 type:.TestEnum2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -140,10 +140,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum2, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum2 VALUE_PARAMETER name:other index:0 type:.TestEnum2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -190,10 +190,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum2, other:.TestEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum2 VALUE_PARAMETER name:other index:0 type:.TestEnum2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -286,10 +286,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum3) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum3, other:.TestEnum3) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum3 VALUE_PARAMETER name:other index:0 type:.TestEnum3 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -403,10 +403,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum4) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum4, other:.TestEnum4) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum4 VALUE_PARAMETER name:other index:0 type:.TestEnum4 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -475,10 +475,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum4) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum4, other:.TestEnum4) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum4 VALUE_PARAMETER name:other index:0 type:.TestEnum4 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -586,10 +586,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum5, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum5 VALUE_PARAMETER name:other index:0 type:.TestEnum5 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -635,10 +635,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum5, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum5 VALUE_PARAMETER name:other index:0 type:.TestEnum5 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -685,10 +685,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum5, other:.TestEnum5) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum5 VALUE_PARAMETER name:other index:0 type:.TestEnum5 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -821,10 +821,10 @@ FILE fqName: fileName:/enum.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum6) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum6, other:.TestEnum6) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum6 VALUE_PARAMETER name:other index:0 type:.TestEnum6 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt index 0951deaf4cc..0937d29949e 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt @@ -87,10 +87,10 @@ FILE fqName: fileName:/enumClassModality.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestFinalEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestFinalEnum2, other:.TestFinalEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestFinalEnum2 VALUE_PARAMETER name:other index:0 type:.TestFinalEnum2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -235,10 +235,10 @@ FILE fqName: fileName:/enumClassModality.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestOpenEnum1) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestOpenEnum1, other:.TestOpenEnum1) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestOpenEnum1 VALUE_PARAMETER name:other index:0 type:.TestOpenEnum1 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -325,10 +325,10 @@ FILE fqName: fileName:/enumClassModality.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestOpenEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestOpenEnum2, other:.TestOpenEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestOpenEnum2 VALUE_PARAMETER name:other index:0 type:.TestOpenEnum2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -422,10 +422,10 @@ FILE fqName: fileName:/enumClassModality.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestAbstractEnum1) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestAbstractEnum1, other:.TestAbstractEnum1) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestAbstractEnum1 VALUE_PARAMETER name:other index:0 type:.TestAbstractEnum1 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -548,10 +548,10 @@ FILE fqName: fileName:/enumClassModality.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestAbstractEnum2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestAbstractEnum2, other:.TestAbstractEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestAbstractEnum2 VALUE_PARAMETER name:other index:0 type:.TestAbstractEnum2 PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String [fake_override] diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt index 97d5d99b341..5add618d859 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt @@ -43,10 +43,10 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.A) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.A, other:.A) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:other index:0 type:.A FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -120,10 +120,10 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.A) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.A, other:.A) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:other index:0 type:.A FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -192,10 +192,10 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.A) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.A, other:.A) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:other index:0 type:.A FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt index 40a6b48ee2d..c23160d00e7 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt @@ -37,10 +37,10 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Test0) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Test0, other:.Test0) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Test0 VALUE_PARAMETER name:other index:0 type:.Test0 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -148,10 +148,10 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Test1) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Test1, other:.Test1) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:other index:0 type:.Test1 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -198,10 +198,10 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Test1) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Test1, other:.Test1) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:other index:0 type:.Test1 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -316,10 +316,10 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Test2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Test2, other:.Test2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:other index:0 type:.Test2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -373,10 +373,10 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Test2) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Test2, other:.Test2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:other index:0 type:.Test2 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt index 04b981821dd..348697f6c92 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt @@ -49,10 +49,10 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum, other:.TestEnum) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum VALUE_PARAMETER name:other index:0 type:.TestEnum FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -105,10 +105,10 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.TestEnum) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.TestEnum, other:.TestEnum) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.TestEnum VALUE_PARAMETER name:other index:0 type:.TestEnum FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt index a453560cc03..b5775692f61 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt @@ -48,10 +48,10 @@ FILE fqName: fileName:/enumEntryAsReceiver.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.X) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.X, other:.X) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.X VALUE_PARAMETER name:other index:0 type:.X FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt index 789ded4f56f..fe5321470b6 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt @@ -113,10 +113,10 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.MyEnum) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.MyEnum, other:.MyEnum) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.MyEnum VALUE_PARAMETER name:other index:0 type:.MyEnum FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt index aed10b9f60c..ce846847ceb 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt @@ -59,10 +59,10 @@ FILE fqName: fileName:/temporaryInEnumEntryInitializer.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.En) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.En, other:.En) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.En VALUE_PARAMETER name:other index:0 type:.En FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt index 023d1a3d87b..ccde07f684c 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt @@ -47,10 +47,10 @@ FILE fqName: fileName:/enumEntry.kt overridden: protected final fun clone (): kotlin.Any declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum - FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:.Z) returnType:kotlin.Int [fake_override,operator] + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:.Z, other:.Z) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum + $this: VALUE_PARAMETER name: type:.Z VALUE_PARAMETER name:other index:0 type:.Z FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: