Skip to content

Commit 75863a4

Browse files
committed
Specialize to await call() only
1 parent 5adf014 commit 75863a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mypy/checker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4925,8 +4925,10 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
49254925
allow_none_func_call = is_lambda or declared_none_return or declared_any_return
49264926

49274927
# Return with a value.
4928-
if isinstance(
4929-
s.expr, (CallExpr, ListExpr, TupleExpr, DictExpr, SetExpr, OpExpr, AwaitExpr)
4928+
if (
4929+
isinstance(s.expr, (CallExpr, ListExpr, TupleExpr, DictExpr, SetExpr, OpExpr))
4930+
or isinstance(s.expr, AwaitExpr)
4931+
and isinstance(s.expr.expr, CallExpr)
49304932
):
49314933
# For expressions that (strongly) depend on type context (i.e. those that
49324934
# are handled like a function call), we allow fallback to empty type context

0 commit comments

Comments
 (0)