forked from microsoft/pyright
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug in code flow engine that led to incorrect type evaluation o…
…f a variable in a nested loop. This addresses https://github.com/microsoft/pylance-release/issues/4509.
- Loading branch information
1 parent
056415f
commit 23bcbce
Showing
3 changed files
with
53 additions
and
4 deletions.
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
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,22 @@ | ||
# This sample tests a code flow graph that includes a nested loop | ||
# and a variable that is assigned only in the outer loop. | ||
|
||
|
||
# pyright: strict | ||
|
||
|
||
# * Code flow graph for func1: | ||
# Assign[step+=1] ── True[step==0] ── Assign[node=] ── Loop ┬─ Loop ┬─ Assign[step=1] ── Start | ||
# │ ╰ Circular(Assign[step+=1]) | ||
# ╰ FalseNever ─ False ─ Circular(Assign[node]) | ||
def func1(nodes: list[int]): | ||
step = 1 | ||
while True: | ||
for node in nodes: | ||
if node or step == 0: | ||
step += 1 | ||
break | ||
else: | ||
return | ||
|
||
|
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