You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NoneTyp is special cased in a lot of places, but—with strict optional—for the most part it behaves like a normal Instance type (and the special casing has to recreate that behavior). If we started tracking the truthiness of objects (see #1698), I think we could get rid of the vast majority of NoneTyp's special casing. (The only thing that I can think of that would remain its role in partial types.) This would make the code easier to reason about, and would have prevented some of the strict optional bugs we've seen so far.
The text was updated successfully, but these errors were encountered:
My work on #1689 (see #1989) removed some references/special casing for NoneType inside find_isinstance_check. There's still another one there related to x is None and x is not None, probably those could be replaced by a more general analysis of expression1 is expression2 (if that is true, both expressions have the same type and some narrowings may be done, which can cover x is None as a special case).
NoneTyp
is special cased in a lot of places, but—with strict optional—for the most part it behaves like a normalInstance
type (and the special casing has to recreate that behavior). If we started tracking the truthiness of objects (see #1698), I think we could get rid of the vast majority ofNoneTyp
's special casing. (The only thing that I can think of that would remain its role in partial types.) This would make the code easier to reason about, and would have prevented some of the strict optional bugs we've seen so far.The text was updated successfully, but these errors were encountered: