diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 1911714de96..5b2b2d871e0 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -25,12 +25,14 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.types.* +import org.jetbrains.kotlin.ir.util.parentClassOrNull import org.jetbrains.kotlin.psi.KtPropertyDelegate import org.jetbrains.kotlin.psi2ir.generators.hasNoSideEffects @@ -181,7 +183,7 @@ internal class CallAndReferenceGenerator( return qualifiedAccess.convertWithOffsets { startOffset, endOffset -> val dispatchReceiver = qualifiedAccess.dispatchReceiver if (qualifiedAccess.calleeReference is FirSuperReference) { - if (typeRef !is FirComposedSuperTypeRef && dispatchReceiver !is FirNoReceiverExpression) { + if (dispatchReceiver !is FirNoReceiverExpression) { return@convertWithOffsets visitor.convertToIrExpression(dispatchReceiver) } } @@ -189,9 +191,18 @@ internal class CallAndReferenceGenerator( if (dispatchReceiver is FirQualifiedAccess) { val dispatchReceiverReference = dispatchReceiver.calleeReference if (dispatchReceiverReference is FirSuperReference) { - val coneSuperType = dispatchReceiverReference.superTypeRef.coneTypeSafe() - (coneSuperType?.lookupTag?.toSymbol(session) as? FirClassSymbol<*>)?.let { - superQualifierSymbol = classifierStorage.getIrClassSymbol(it) + val superTypeRef = dispatchReceiverReference.superTypeRef + val coneSuperType = superTypeRef.coneTypeSafe() + if (coneSuperType != null) { + val firClassSymbol = coneSuperType.lookupTag.toSymbol(session) as? FirClassSymbol<*> + if (firClassSymbol != null) { + superQualifierSymbol = classifierStorage.getIrClassSymbol(firClassSymbol) + } + } else if (superTypeRef is FirComposedSuperTypeRef) { + val owner = symbol?.owner + if (owner != null && owner is IrDeclaration) { + superQualifierSymbol = owner.parentClassOrNull?.symbol + } } } } diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index a53515b4212..f2d1b03897d 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -245,6 +245,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { public void testSuperCalls() throws Exception { runTest("compiler/testData/ir/irText/classes/superCalls.kt"); } + + @TestMetadata("superCallsComposed.kt") + public void testSuperCallsComposed() throws Exception { + runTest("compiler/testData/ir/irText/classes/superCallsComposed.kt"); + } } @TestMetadata("compiler/testData/ir/irText/declarations") diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt index 9e19365e94c..ef20685a684 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt @@ -10,9 +10,17 @@ import org.jetbrains.kotlin.fir.expressions.FirConstKind import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.name.ClassId +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract inline fun FirTypeRef.coneTypeUnsafe() = (this as FirResolvedTypeRef).type as T -inline fun FirTypeRef.coneTypeSafe() = (this as? FirResolvedTypeRef)?.type as? T +@OptIn(ExperimentalContracts::class) +inline fun FirTypeRef.coneTypeSafe(): T? { + contract { + returnsNotNull() implies (this@coneTypeSafe is FirResolvedTypeRef) + } + return (this as? FirResolvedTypeRef)?.type as? T +} val FirTypeRef.isAny: Boolean get() = isBuiltinType(StandardClassIds.Any, false) val FirTypeRef.isNullableAny: Boolean get() = isBuiltinType(StandardClassIds.Any, true) diff --git a/compiler/testData/codegen/box/jvm8/capturedSuperCall.kt b/compiler/testData/codegen/box/jvm8/capturedSuperCall.kt index db8dafe0581..5757ce97209 100644 --- a/compiler/testData/codegen/box/jvm8/capturedSuperCall.kt +++ b/compiler/testData/codegen/box/jvm8/capturedSuperCall.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // FILE: IBase.java diff --git a/compiler/testData/codegen/box/jvm8/defaults/capturedSuperCall.kt b/compiler/testData/codegen/box/jvm8/defaults/capturedSuperCall.kt index 558ef8feff6..63d0599b2d2 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/capturedSuperCall.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/capturedSuperCall.kt @@ -1,5 +1,4 @@ // !JVM_DEFAULT_MODE: enable -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt index aa1aebe0a41..7a154be1009 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: IBase.java diff --git a/compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt b/compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt index 52115bac21c..557905cedbe 100644 --- a/compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt +++ b/compiler/testData/codegen/box/super/innerClassQualifiedFunctionCall.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR interface T { open fun baz(): String = "T.baz" } diff --git a/compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt b/compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt index a8f23ad3649..bdcd70ce962 100644 --- a/compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt +++ b/compiler/testData/codegen/box/super/innerClassQualifiedPropertyAccess.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR interface T { open val baz: String get() = "T.baz" diff --git a/compiler/testData/codegen/box/super/unqualifiedSuper.kt b/compiler/testData/codegen/box/super/unqualifiedSuper.kt index 78edaf75489..9863671fa68 100644 --- a/compiler/testData/codegen/box/super/unqualifiedSuper.kt +++ b/compiler/testData/codegen/box/super/unqualifiedSuper.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR open class Base() { open fun baseFun(): String = "Base.baseFun()" diff --git a/compiler/testData/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt b/compiler/testData/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt index 1cf0899bf00..c9ab55a897d 100644 --- a/compiler/testData/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt +++ b/compiler/testData/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR open class DeeperBase { open fun deeperBaseFun(): String = "DeeperBase.deeperBaseFun()" diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt index ad44220595b..a902d879d49 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt @@ -101,8 +101,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.K4 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String? declared in .K4' - CALL 'public open fun foo (): kotlin.String? declared in .JUnrelatedFoo' type=kotlin.String? origin=null - $this: ERROR_CALL 'Unresolved reference: super' type=IrErrorType + CALL 'public open fun foo (): kotlin.String? declared in .JUnrelatedFoo' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JUnrelatedFoo modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.String? origin=null + $this: GET_VAR ': .K4 declared in .K4.foo' type=.K4 origin=null 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 diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.fir.txt b/compiler/testData/ir/irText/classes/superCallsComposed.fir.txt new file mode 100644 index 00000000000..1514301a285 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.fir.txt @@ -0,0 +1,93 @@ +FILE fqName: fileName:/superCallsComposed.kt + CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + CONSTRUCTOR visibility:public <> () returnType:.Base [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:OPEN <> ($this:.Base) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + PROPERTY name:bar visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.Base) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Base' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Base declared in .Base.' type=.Base origin=null + 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 + CLASS INTERFACE name:BaseI modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BaseI + FUN name:foo visibility:public modality:ABSTRACT <> ($this:.BaseI) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.BaseI + PROPERTY name:bar visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.BaseI) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.BaseI + 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 + CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base; .BaseI] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Derived + CONSTRUCTOR visibility:public <> () returnType:.Derived [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Base' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base; .BaseI]' + FUN name:foo visibility:public modality:FINAL <> ($this:.Derived) returnType:kotlin.Unit + overridden: + public open fun foo (): kotlin.Unit declared in .Base + public abstract fun foo (): kotlin.Unit declared in .BaseI + $this: VALUE_PARAMETER name: type:.Derived + BLOCK_BODY + CALL 'public open fun foo (): kotlin.Unit declared in .Base' superQualifier='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit origin=null + $this: GET_VAR ': .Derived declared in .Derived.foo' type=.Derived origin=null + PROPERTY name:bar visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL <> ($this:.Derived) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:FINAL [val] + overridden: + public open fun (): kotlin.String declared in .Base + public abstract fun (): kotlin.String declared in .BaseI + $this: VALUE_PARAMETER name: type:.Derived + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Derived' + CALL 'public open fun (): kotlin.String declared in .Base' superQualifier='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Derived declared in .Derived.' type=.Derived origin=null + 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 diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.kt b/compiler/testData/ir/irText/classes/superCallsComposed.kt new file mode 100644 index 00000000000..30a8e45d4a3 --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.kt @@ -0,0 +1,19 @@ +open class Base { + open fun foo() {} + + open val bar: String = "" +} + +interface BaseI { + fun foo() + val bar: String +} + +class Derived : Base(), BaseI { + override fun foo() { + super.foo() + } + + override val bar: String + get() = super.bar +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/superCallsComposed.txt b/compiler/testData/ir/irText/classes/superCallsComposed.txt new file mode 100644 index 00000000000..f2ca49dccfa --- /dev/null +++ b/compiler/testData/ir/irText/classes/superCallsComposed.txt @@ -0,0 +1,96 @@ +FILE fqName: fileName:/superCallsComposed.kt + CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + CONSTRUCTOR visibility:public <> () returnType:.Base [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:OPEN <> ($this:.Base) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + PROPERTY name:bar visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.Base) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Base' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Base declared in .Base.' type=.Base origin=null + 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 + CLASS INTERFACE name:BaseI modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BaseI + FUN name:foo visibility:public modality:ABSTRACT <> ($this:.BaseI) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.BaseI + PROPERTY name:bar visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.BaseI) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.BaseI + 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 + CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base; .BaseI] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Derived + CONSTRUCTOR visibility:public <> () returnType:.Derived [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Base' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base; .BaseI]' + FUN name:foo visibility:public modality:OPEN <> ($this:.Derived) returnType:kotlin.Unit + overridden: + public open fun foo (): kotlin.Unit declared in .Base + public abstract fun foo (): kotlin.Unit declared in .BaseI + $this: VALUE_PARAMETER name: type:.Derived + BLOCK_BODY + CALL 'public open fun foo (): kotlin.Unit declared in .Base' superQualifier='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit origin=null + $this: GET_VAR ': .Derived declared in .Derived.foo' type=.Derived origin=null + PROPERTY name:bar visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.Derived) returnType:kotlin.String + correspondingProperty: PROPERTY name:bar visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .Base + public abstract fun (): kotlin.String declared in .BaseI + $this: VALUE_PARAMETER name: type:.Derived + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .Derived' + CALL 'public open fun (): kotlin.String declared in .Base' superQualifier='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .Derived declared in .Derived.' type=.Derived origin=null + 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 [fake_override,operator] declared in .Base + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .BaseI + $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 [fake_override] declared in .Base + public open fun hashCode (): kotlin.Int [fake_override] declared in .BaseI + $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 [fake_override] declared in .Base + public open fun toString (): kotlin.String [fake_override] declared in .BaseI + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index b8a65c65017..ee268f7f7e5 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -244,6 +244,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { public void testSuperCalls() throws Exception { runTest("compiler/testData/ir/irText/classes/superCalls.kt"); } + + @TestMetadata("superCallsComposed.kt") + public void testSuperCallsComposed() throws Exception { + runTest("compiler/testData/ir/irText/classes/superCallsComposed.kt"); + } } @TestMetadata("compiler/testData/ir/irText/declarations")