Closed munificent closed 4 years ago
It looks like the analyzer's current implementation of LUB thinks that the LUB of types int
and Null
is int
(which was correct pre-NNBD but is wrong under the new NNBD rules).
CC @scheglov who is currently working on improvements to LUB
@scheglov confirmed that under the new rules he's implementing, LUB(int, Null)
will be int?
, so this should work fine once that work is done.
Fixed in 6444fba9c71d5125799afe5798afb6f26a110b43.
Thanks!
Take this program:
And analyze it with:
I would expect two errors, because the result of
?:
is nullable and it is being used in non-nullable contexts. Instead, I get: