Skip to content

Commit 83f5f77

Browse files
committed
New analyzer: improve documentation of defer()
This concludes documentation that started in #7130 and #7135. Closes #7071.
1 parent dab5b29 commit 83f5f77

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mypy/newsemanal/semanal.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,10 +4262,14 @@ def defer(self, debug_context: Optional[Context] = None) -> None:
42624262
"""Defer current analysis target to be analyzed again.
42634263
42644264
This must be called if something in the current target is
4265-
incomplete or has a placeholder node.
4266-
4267-
This must not be called during the final analysis iteration!
4268-
Instead, an error should be generated.
4265+
incomplete or has a placeholder node. However, this must *not*
4266+
be called during the final analysis iteration! Instead, an error
4267+
should be generated. Often 'process_placeholder' is a good
4268+
way to either defer or generate an error.
4269+
4270+
NOTE: Some methods, such as 'anal_type', 'mark_incomplete' and
4271+
'record_incomplete_ref', call this implicitly, or when needed.
4272+
They are usually preferable to a direct defer() call.
42694273
"""
42704274
assert not self.final_iteration, 'Must not defer during final iteration'
42714275
self.deferred = True

0 commit comments

Comments
 (0)