We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3416461 commit 419c936Copy full SHA for 419c936
2 files changed
mypy/checker.py
@@ -7072,6 +7072,8 @@ def refine_away_none_in_comparison(
7072
non_optional_types = []
7073
for i in chain_indices:
7074
typ = operand_types[i]
7075
+ if isinstance(get_proper_type(typ), AnyType):
7076
+ continue
7077
if not is_overlapping_none(typ):
7078
non_optional_types.append(typ)
7079
mypy/types_utils.py
@@ -123,7 +123,7 @@ def is_generic_instance(tp: Type) -> bool:
123
124
def is_overlapping_none(t: Type) -> bool:
125
t = get_proper_type(t)
126
- return isinstance(t, (NoneType, AnyType)) or (
+ return isinstance(t, NoneType) or (
127
isinstance(t, UnionType) and any(isinstance(get_proper_type(e), NoneType) for e in t.items)
128
)
129
0 commit comments