Skip to content

Conversation

@tannguyencse19
Copy link
Contributor

Summary

Fix implicit return inference so trailing for loops no longer cause functions without explicit return to be inferred as returning Never

Fixes #1491

Test Plan

cargo test -p pyrefly test_infer_return_in_for_loop

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

"#,
);

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inferred return type of Never when a method body contains a for loop

3 participants