Emit virtual call for comparison operators - #4313
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughOrdering operators preserve primitive opcode lowering and dispatch non-primitive operands through ChangesOrdering Compare dispatch
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CompilerLowering
participant PrimitiveOpcode
participant CompareVirtualCall
participant BamlOpsCompare
CompilerLowering->>PrimitiveOpcode: lower primitive-compatible operands
CompilerLowering->>CompareVirtualCall: lower non-primitive ordering
CompareVirtualCall->>BamlOpsCompare: invoke lt, le, gt, or ge
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
baml_language/crates/baml_compiler2_mir/src/lower.rs (1)
6303-6310: 📐 Maintainability & Code Quality | 🔵 TrivialTrack the documented
!=limitation.The comment records a real behavior gap: an
Equals.neqoverride is ignored by the!=operator. The comment has no issue reference, so the gap can be lost.Do you want me to open a tracking issue that captures this analysis?
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler2_mir/src/lower.rs` around lines 6303 - 6310, Open a tracking issue for the documented limitation in the != lowering near the Equals.neq handling, recording that operator dispatch ignores neq overrides for inconsistent eq/neq implementations and that cross-type semantics require a design decision. Link or reference the tracking issue in the existing BUG comment so the limitation remains discoverable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@baml_language/crates/baml_tests/baml_src/ns_operators/operators.baml`:
- Around line 696-707: Update ord_into_capture so the lambda assigns a
comparison result that evaluates to true, allowing the final assertion to verify
that set() wrote to out rather than merely observing its initial false value.
---
Nitpick comments:
In `@baml_language/crates/baml_compiler2_mir/src/lower.rs`:
- Around line 6303-6310: Open a tracking issue for the documented limitation in
the != lowering near the Equals.neq handling, recording that operator dispatch
ignores neq overrides for inconsistent eq/neq implementations and that
cross-type semantics require a design decision. Link or reference the tracking
issue in the existing BUG comment so the limitation remains discoverable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 33dd5fa9-457b-47a3-8911-9db57985c4a3
⛔ Files ignored due to path filters (1)
baml_language/crates/baml_tests/snapshots/baml_src/operators.snapis excluded by!**/*.snap
📒 Files selected for processing (4)
baml_language/crates/baml_compiler2_mir/src/lower.rsbaml_language/crates/baml_tests/baml_src/ns_operators/operators.bamlbaml_language/crates/baml_tests/tests/interfaces.rsbaml_language/crates/bex_vm/tests/comparison_driver.rs
Binary size checks passed✅ 7 passed
Generated by |
5269ffb to
607ec85
Compare
Summary by CodeRabbit
New Features
<,<=,>,>=) now support custom comparison behavior for user-defined types, enums, booleans, generics, and interface implementations.Bug Fixes
Tests