Skip to content
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

New analyzer: improve documentation of defer() #7159

Merged
merged 1 commit into from
Jul 5, 2019
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
12 changes: 8 additions & 4 deletions mypy/newsemanal/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4262,10 +4262,14 @@ def defer(self, debug_context: Optional[Context] = None) -> None:
"""Defer current analysis target to be analyzed again.

This must be called if something in the current target is
incomplete or has a placeholder node.

This must not be called during the final analysis iteration!
Instead, an error should be generated.
incomplete or has a placeholder node. However, this must *not*
be called during the final analysis iteration! Instead, an error
should be generated. Often 'process_placeholder' is a good
way to either defer or generate an error.

NOTE: Some methods, such as 'anal_type', 'mark_incomplete' and
'record_incomplete_ref', call this implicitly, or when needed.
They are usually preferable to a direct defer() call.
"""
assert not self.final_iteration, 'Must not defer during final iteration'
self.deferred = True
Expand Down