From b5394d79b9ab6d4f440e5cb22cd10cdb6ed204a5 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 4 Jul 2023 12:32:28 +0200 Subject: [PATCH] [FIR] remove user code leaks from `compiler.fir.tree` module, add more information to some errors --- .../src/org/jetbrains/kotlin/fir/symbols/FirBasedSymbol.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/FirBasedSymbol.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/FirBasedSymbol.kt index 0dbb24254e5..58b6d9bbb02 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/FirBasedSymbol.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/FirBasedSymbol.kt @@ -17,8 +17,10 @@ import org.jetbrains.kotlin.fir.expressions.arguments import org.jetbrains.kotlin.fir.symbols.impl.FirBackingFieldSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.coneType +import org.jetbrains.kotlin.fir.utils.exceptions.withFirSymbolIdEntry import org.jetbrains.kotlin.mpp.DeclarationSymbolMarker import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment abstract class FirBasedSymbol : DeclarationSymbolMarker { private var _fir: E? = null @@ -26,7 +28,9 @@ abstract class FirBasedSymbol : DeclarationSymbolMarker { @SymbolInternals val fir: E get() = _fir - ?: error("Fir is not initialized for $this") + ?: errorWithAttachment("Fir is not initialized for ${this::class}") { + withFirSymbolIdEntry("symbol", this@FirBasedSymbol) + } fun bind(e: E) { _fir = e