Skip to content

Restore the original logic on leaving partial types #4022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2017
Merged
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
7 changes: 4 additions & 3 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2659,10 +2659,11 @@ def enter_partial_types(self) -> Iterator[None]:
if isinstance(var.type, PartialType) and var.type.type is None:
# None partial type: assume variable is intended to have type None
var.type = NoneTyp()
elif var not in self.partial_reported:
self.msg.fail(messages.NEED_ANNOTATION_FOR_VAR, context)
else:
if var not in self.partial_reported:
self.msg.fail(messages.NEED_ANNOTATION_FOR_VAR, context)
self.partial_reported.add(var)
var.type = AnyType(TypeOfAny.from_error)
self.partial_reported.add(var)

def find_partial_types(self, var: Var) -> Optional[Dict[Var, Context]]:
for partial_types in reversed(self.partial_types):
Expand Down