Repository navigation
fix(compiler): validate arithmetic through operator interfaces - #4222
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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 (6)
📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughArithmetic inference now resolves through operator interfaces and shared primitive metadata before folding. String addition is declared in the standard library, implemented in the VM, and covered by driver and compiler tests. ChangesArithmetic interfaces
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Source
participant TIRBuilder
participant OpsInterface
participant PackageBamlImpl
participant BexStr
Source->>TIRBuilder: parse arithmetic expression
TIRBuilder->>OpsInterface: resolve arithmetic operator
OpsInterface-->>TIRBuilder: validate operand and result types
TIRBuilder->>PackageBamlImpl: execute string addition
PackageBamlImpl->>BexStr: concatenate operands
BexStr-->>PackageBamlImpl: return concatenated value
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 |
⏭️ 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):
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/src/compiler2_tir/phase3a.rs`:
- Around line 1018-1037: Run `cargo test --lib` for the affected crates
`baml_type`, `baml_compiler2_mir`, `baml_compiler2_tir`, and `baml_tests`, and
resolve any failures before merging the regression test
`compound_assign_float_plus_string_is_rejected_in_tir`.
🪄 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: ebed1f88-242b-4dd3-a77e-4a10a46442f3
📒 Files selected for processing (9)
baml_language/crates/baml_builtins2/baml_std/baml/ns_ops/math.bamlbaml_language/crates/baml_compiler2_mir/src/lower.rsbaml_language/crates/baml_compiler2_tir/src/builder.rsbaml_language/crates/baml_tests/baml_src/ns_operators/operators.bamlbaml_language/crates/baml_tests/src/compiler2_tir/phase3a.rsbaml_language/crates/baml_tests/tests/interfaces.rsbaml_language/crates/baml_type/src/lib.rsbaml_language/crates/baml_type/src/names.rsbaml_language/crates/bex_vm/src/package_baml/ops_math.rs
Binary size checks passed✅ 7 passed
Generated by |
c4c50fe to
eff05e7
Compare
eff05e7 to
b10b114
Compare
Issue Reference
B-987
Changes
Testing
Screenshots
Not applicable.
PR Checklist
Summary by CodeRabbit
New Features
+operator (e.g.,"hello" + " world"), including correct runtime behavior for string addition.Bug Fixes
+=with string operands, with more consistent diagnostics.Tests
+dispatch/drivers, arithmetic dispatch matrices, and unsupported structural arithmetic.