[FIR] Fix checking for null exhaustiveness with expression of Nothing? type

This commit is contained in:
Dmitriy Novozhilov
2021-02-04 15:23:45 +03:00
parent 76f9830b47
commit 3f715e671d
@@ -97,6 +97,10 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
}
}
is FirQualifiedAccessExpression -> {
if (argument.typeRef.isNullableNothing) {
data.containsNull = true
return
}
val reference = argument.calleeReference as? FirResolvedNamedReference ?: return
val symbol = (reference.resolvedSymbol.fir as? FirEnumEntry)?.symbol ?: return
@@ -185,6 +189,12 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
is FirResolvedQualifier -> {
argument.typeRef.accept(this, data)
}
is FirQualifiedAccessExpression -> {
if (argument.typeRef.isNullableNothing) {
data.containsNull = true
}
}
}
}
}