-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed recent regression that results in false positive when a inner f…
…unction with an inferred return type is a coroutine (async) and is referenced within the function body in which it's declared. This addresses #8232 and #8229.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/pyright-internal/src/tests/samples/coroutines4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This sample tests the case where an inner coroutine with an inferred | ||
# return type is referenced in a manner that results in recursion. | ||
|
||
import asyncio | ||
|
||
|
||
def func1(replace_inner: bool) -> None: | ||
inner = lambda: None | ||
|
||
async def wrapper(): | ||
inner() | ||
|
||
wrapped_fn = wrapper() | ||
asyncio.create_task(wrapped_fn) | ||
|
||
if replace_inner: | ||
inner = lambda: None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters