[FIR] Store fir for invalid when branches

^KTIJ-25646 fixed

Merge-request: KT-MR-10646
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
Egor Kulikov
2023-06-20 16:11:31 +00:00
committed by Space Team
parent 37876313c9
commit b147b7e929
32 changed files with 258 additions and 58 deletions
@@ -27,7 +27,7 @@ internal class FirWhenSubjectExpressionImpl(
override var annotations: MutableOrEmptyList<FirAnnotation>,
override val whenRef: FirExpressionRef<FirWhenExpression>,
) : FirWhenSubjectExpression() {
override val typeRef: FirTypeRef get() = whenRef.value.subject!!.typeRef
override val typeRef: FirTypeRef get() = whenRef.value.subject?.typeRef ?: org.jetbrains.kotlin.fir.types.impl.FirImplicitUnitTypeRef(source)
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) }
@@ -418,7 +418,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
impl(whenSubjectExpression) {
default("typeRef") {
value = "whenRef.value.subject!!.typeRef"
value = "whenRef.value.subject?.typeRef ?: org.jetbrains.kotlin.fir.types.impl.FirImplicitUnitTypeRef(source)"
withGetter = true
}
useTypes(whenExpression)