FIR: ignore redundant DEFINITELY_NOT_NULL_TYPE flags in deserialization

I.e. if T is already bounded by Any, deserialize T&Any as simply T
(instead of producing either an error type or an NPE, the latter
happening when the T&Any is the lower bound of a flexible type somehow)

Once again this is a problem of the kind where some weird combination of
FE1.0 and FIR causes a weird edge case error on invalid input and creating
a test with that specific setup is not really feasible.
This commit is contained in:
pyos
2022-09-15 12:39:43 +02:00
committed by Denis.Zharkov
parent aeccc2e787
commit 51619e0969
@@ -149,7 +149,7 @@ class FirTypeDeserializer(
if (constructor is ConeTypeParameterLookupTag) {
return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable).let {
if (Flags.DEFINITELY_NOT_NULL_TYPE.get(proto.flags))
ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext)
ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext) ?: it
else
it
}