Type narrowing under early returns#3133
Merged
imalsogreg merged 2 commits intocanaryfrom Feb 19, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📝 Walkthrough🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Binary size checks passed✅ 7 passed
Generated by |
acac5e6 to
d531934
Compare
fdba94f to
68b9575
Compare
baml_language/crates/baml_lsp_actions_tests/test_files/syntax/expr/early_return_narrowing.baml
Show resolved
Hide resolved
68b9575 to
69d31e3
Compare
typecheck refactor and cleanup
69d31e3 to
9733d87
Compare
Addressed all the comments.
Comment on lines
+502
to
+508
| // Case 3: if (cont) { <diverges> } else { ... } | ||
| // After the if, cond was false. | ||
| if let Some(else_br) = else_branch { | ||
| if definitely_diverges(*then_branch, body) && !definitely_diverges(*else_br, body) { | ||
| return extract_condition_narrowing(ctx, *condition, body, false); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Typo in comment: "cont" → "cond".
📝 Proposed fix
- // Case 3: if (cont) { <diverges> } else { ... }
+ // Case 3: if (cond) { <diverges> } else { ... }
This was referenced Feb 20, 2026
This was referenced Mar 4, 2026
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.
Summary by CodeRabbit
New Features
Tests