Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def visit_none_type(self, t: NoneType) -> ProperType:
if state.strict_optional:
if isinstance(self.s, (NoneType, UninhabitedType)):
return t
elif isinstance(self.s, UnboundType):
elif isinstance(self.s, (UnboundType, AnyType)):
return AnyType(TypeOfAny.special_form)
else:
return mypy.typeops.make_simplified_union([self.s, t])
Expand Down
2 changes: 1 addition & 1 deletion mypy/meet.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def __init__(self, s: ProperType) -> None:
def visit_unbound_type(self, t: UnboundType) -> ProperType:
if isinstance(self.s, NoneType):
if state.strict_optional:
return AnyType(TypeOfAny.special_form)
return UninhabitedType()
else:
return self.s
elif isinstance(self.s, UninhabitedType):
Expand Down
6 changes: 2 additions & 4 deletions mypy/test/testtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,7 @@ def test_any_type(self) -> None:
self.fx.anyt,
self.fx.a,
self.fx.o,
# TODO: fix this is not currently symmetric
# NoneType(),
NoneType(),
UnboundType("x"),
self.fx.t,
self.tuple(),
Expand Down Expand Up @@ -1177,8 +1176,7 @@ def test_none(self) -> None:
self.assert_meet(self.fx.o, NoneType(), NoneType())
for t in [
self.fx.a,
# TODO: fix this is not currently symmetric
# UnboundType("x"),
UnboundType("x"),
self.fx.t,
self.tuple(),
self.callable(self.fx.a, self.fx.b),
Expand Down