Repository navigation
fix(flow): reuse ordered return analysis for loop exits - #1037
Merged
CppCXY merged 1 commit intoApr 17, 2026
Merged
Conversation
lewis6991
force-pushed
the
fix/ordered-return-analysis-loops
branch
from
April 16, 2026 13:10
513f888 to
056ec9d
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the function body return analysis by introducing a FuncBodyFlow struct to track control flow states such as continuation, exit, and divergence. This enhancement allows for more accurate return type inference and diagnostic checks, particularly for loops with truthy conditions (e.g., while true). The check_return_count diagnostic was simplified to leverage this new flow analysis. A logic error was identified in the repeat_flow implementation regarding how infinite loops affect the ability of a function to continue past the loop structure.
lewis6991
force-pushed
the
fix/ordered-return-analysis-loops
branch
3 times, most recently
from
April 16, 2026 16:37
65dc617 to
6619bc3
Compare
Use the same ordered block walker for inferred returns, MissingReturn, and module return selection so loops, breaks, and stalling paths follow the same control-flow rules. Keep `pred()`-style call conditions dynamic instead of pruning branches from their inferred return type, and add Lua block regressions for closure returns, module exports, and MissingReturn.
lewis6991
force-pushed
the
fix/ordered-return-analysis-loops
branch
from
April 17, 2026 09:56
6619bc3 to
66f9ec1
Compare
Contributor
|
regression in nvim-treesitter's
at line 344. |
Collaborator
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the old missing-return special cases with the same ordered block
walker used for inferred returns. This avoids false MissingReturn
diagnostics for functions that return from truthy while/repeat loops,
keeps break and repeat-until flow consistent across inference and
diagnostics, and adds regressions for closure returns, diagnostics, and
module exports.