From 6df9ce23f7c3e113190c7cb5dfe1f42c4032986e Mon Sep 17 00:00:00 2001 From: "marat.akhin" Date: Thu, 20 Jul 2023 17:54:53 +0200 Subject: [PATCH] [FIR2IR] Configure Unit built-in to have kotlin.Any as a supertype Without this change, the Unit type does not have Any members declared in its scope which breaks the expect/actual mapping (aka we cannot find actual `toString` for expect one). --- .../org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt index 39d22683a5b..538426b16a3 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/IrBuiltInsOverFir.kt @@ -95,7 +95,10 @@ class IrBuiltInsOverFir( override val nothingType: IrType get() = nothing.type override val nothingNType: IrType by lazy { nothingType.makeNullable() } - private val unit by createClass(kotlinIrPackage, IdSignatureValues.unit, build = { kind = ClassKind.OBJECT; modality = Modality.FINAL }) + private val unit by createClass(kotlinIrPackage, IdSignatureValues.unit, build = { kind = ClassKind.OBJECT; modality = Modality.FINAL }) { + configureSuperTypes() + finalizeClassDefinition() + } override val unitClass: IrClassSymbol get() = unit.klass override val unitType: IrType get() = unit.type