Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pyrefly/lib/test/callable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,23 @@ def f():
"#,
);

testcase!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe this PR doesn't have the code changes you intended?

This test case seems not relevant, and I also don't see an actual implementation of the loop logic (which may be why tests are failing).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check again

test_walrus_reuse_name_in_if_condition,
r#"
from re import compile

interface_re = compile(r"^foo")
ipv4_re = compile(r"bar$")
line = str()

if match := interface_re.match(line):
pass

if line and (match := ipv4_re.search(line)):
print(match)
"#,
);

testcase!(
test_unbound_local_name_error_in_def,
r#"
Expand Down
15 changes: 15 additions & 0 deletions pyrefly/lib/test/returns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ assert_type(f(), None)
"#,
);

// Regression test for https://github.com/facebook/pyrefly/issues/1491
testcase!(
test_infer_return_in_for_loop,
r#"
from typing import reveal_type

class A:
def f(self, x):
for y in x:
pass

reveal_type(A().f(0)) # E: revealed type: None
"#,
);

testcase!(
test_return_unions,
r#"
Expand Down
Loading