Skip to content

Commit f185c29

Browse files
update meet to return UninhabitedType() in the case of a None + Uninhabited Type Meet
update join to return AnyType in the case of NoneType + AnyType
1 parent 9405bfd commit f185c29

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mypy/join.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def visit_none_type(self, t: NoneType) -> ProperType:
317317
if state.strict_optional:
318318
if isinstance(self.s, (NoneType, UninhabitedType)):
319319
return t
320-
elif isinstance(self.s, UnboundType):
320+
elif isinstance(self.s, (UnboundType, AnyType)):
321321
return AnyType(TypeOfAny.special_form)
322322
else:
323323
return mypy.typeops.make_simplified_union([self.s, t])

mypy/meet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def __init__(self, s: ProperType) -> None:
691691
def visit_unbound_type(self, t: UnboundType) -> ProperType:
692692
if isinstance(self.s, NoneType):
693693
if state.strict_optional:
694-
return AnyType(TypeOfAny.special_form)
694+
return UninhabitedType()
695695
else:
696696
return self.s
697697
elif isinstance(self.s, UninhabitedType):

0 commit comments

Comments
 (0)