diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolDeclarationRendererProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolDeclarationRendererProvider.kt index 0f8e0cb0357..f68c54a4d1d 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolDeclarationRendererProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolDeclarationRendererProvider.kt @@ -30,15 +30,25 @@ internal class KtFirSymbolDeclarationRendererProvider( } override fun render(symbol: KtSymbol, options: KtDeclarationRendererOptions): String { - require(symbol is KtFirSymbol<*>) - val containingSymbol = with(analysisSession) { - (symbol as? KtSymbolWithKind)?.getContainingSymbol() - } - check(containingSymbol is KtFirSymbol<*>?) + return when (symbol) { + is KtPackageSymbol -> { + "package ${symbol.fqName.asString()}" + } + is KtFirSymbol<*> -> { + val containingSymbol = with(analysisSession) { + (symbol as? KtSymbolWithKind)?.getContainingSymbol() + } + check(containingSymbol is KtFirSymbol<*>?) - return symbol.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { fir -> - val containingFir = containingSymbol?.firRef?.withFirUnsafe { it } - FirIdeRenderer.render(fir, containingFir, options, fir.moduleData.session) + symbol.firRef.withFir(FirResolvePhase.BODY_RESOLVE) { fir -> + val containingFir = containingSymbol?.firRef?.withFirUnsafe { it } + FirIdeRenderer.render(fir, containingFir, options, fir.moduleData.session) + } + } + else -> { + error("Unexpected Fir Symbol ${symbol::class.simpleName}") + } } + } }