Skip to content

Commit

Permalink
Added test case for #6645.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Dec 5, 2023
1 parent 0345c45 commit c93d9eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions packages/pyright-internal/src/tests/samples/loop41.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This sample tests a case that involves a loop with a conditional. This
# case regressed and was not caught by any other test cases.
# This sample tests a few cases that involve a loop with a conditional. These
# case regressed and were not caught by any other test cases.

from typing import TypeVar
from typing import TypeVar, Any

T = TypeVar("T")

Expand All @@ -21,3 +21,16 @@ def func3(v1: list[bool], v2: int | str):

# This should generate an error.
func2(v2)


def func4(x: Any, b: Any):
a = x
while a < 1:
if a:
b = int(b)
else:
b = a

if b:
# This should generate an error.
return a.x(dummy)
2 changes: 1 addition & 1 deletion packages/pyright-internal/src/tests/typeEvaluator3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ test('Loop40', () => {
test('Loop41', () => {
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['loop41.py']);

TestUtils.validateResults(analysisResults, 1);
TestUtils.validateResults(analysisResults, 2);
});

test('ForLoop1', () => {
Expand Down

0 comments on commit c93d9eb

Please sign in to comment.