[FIR] Do not throw exception on unexpected FIR for constants

^KTIJ-23263 fixed

Merge-request: KT-MR-10699
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
Egor Kulikov
2023-06-19 17:45:31 +00:00
committed by Space Team
parent e4f1c10bc1
commit 5bb4f469ef
6 changed files with 36 additions and 5 deletions
@@ -264,8 +264,8 @@ internal class KtSymbolByFirBuilder constructor(
is FirFieldSymbol -> buildFieldSymbol(firSymbol)
is FirEnumEntrySymbol -> buildEnumEntrySymbol(firSymbol) // TODO enum entry should not be callable
is FirBackingFieldSymbol -> buildBackingFieldSymbol(firSymbol)
is FirErrorPropertySymbol -> buildErrorVariableSymbol(firSymbol)
is FirErrorPropertySymbol -> throwUnexpectedElementError(firSymbol)
is FirDelegateFieldSymbol -> throwUnexpectedElementError(firSymbol)
}
}
@@ -66,10 +66,7 @@ internal class KtFirCompileTimeConstantProvider(
// ```
// `false` does not have a corresponding elements on the FIR side and hence the containing `FirWhenBranch` is returned. In this
// case, we simply report null since FIR does not know about it.
fir is FirWhenBranch -> null
fir is FirVariableAssignment && fir.source?.kind == KtFakeSourceElementKind.DesugaredIncrementOrDecrement -> null
fir is FirTypeRef -> null
else -> throwUnexpectedFirElementError(fir, sourcePsi)
else -> null
}
}