BE-481: HashQL: Reify null and empty tuple as unit constants#8853
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryLow Risk Overview In New UI tests cover standalone Reviewed by Cursor Bugbot for commit 751639a. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR standardizes MIR reification so that null literals and empty tuple literals are lowered to the canonical unit constant Constant::Unit (()), aligning them with existing unit-expression handling and making MIR output consistent.
Changes:
- Reify
Primitive::Nulldirectly intoConstant::Unitin both atom and rvalue lowering. - Reify empty tuple literals (
#tuple: []) intoConstant::Unitinstead of a zero-field tuple aggregate. - Add new MIR UI tests for
nulland empty tuple reification, and update an existing snapshot to reflect== ()comparisons.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| libs/@local/hashql/mir/src/reify/rvalue.rs | Lowers null primitives and empty tuple data nodes to Constant::Unit during rvalue reification. |
| libs/@local/hashql/mir/src/reify/atom.rs | Lowers null primitives to Constant::Unit when reifying atom operands. |
| libs/@local/hashql/mir/tests/ui/reify/null-value.jsonc | Adds UI test input asserting null literal is promoted to unit. |
| libs/@local/hashql/mir/tests/ui/reify/null-value.stdout | Adds expected MIR output showing return () for null. |
| libs/@local/hashql/mir/tests/ui/reify/null-value-in-binary.jsonc | Adds UI test input asserting null promotion inside a binary expression. |
| libs/@local/hashql/mir/tests/ui/reify/null-value-in-binary.stdout | Adds expected MIR output showing null operands lowered to () before comparison. |
| libs/@local/hashql/mir/tests/ui/reify/empty-tuple.jsonc | Adds UI test input asserting empty tuple literal is promoted to unit. |
| libs/@local/hashql/mir/tests/ui/reify/empty-tuple.stdout | Adds expected MIR output showing empty tuple lowered to (). |
| libs/@local/hashql/mir/tests/ui/pass/inline/filter-aggressive.stdout | Updates snapshot output to reflect null comparisons now printing as == (). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## bm/be-537-hashql-remove-old-backend-wire-up-hashql-in-the-api #8853 +/- ##
=================================================================================================
+ Coverage 76.09% 78.94% +2.85%
=================================================================================================
Files 375 499 +124
Lines 56291 73916 +17625
Branches 1412 1996 +584
=================================================================================================
+ Hits 42834 58353 +15519
- Misses 13011 14916 +1905
- Partials 446 647 +201
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9bd6d9b to
912034f
Compare
585c91d to
1622d96
Compare
912034f to
95715c4
Compare
1622d96 to
c541263
Compare
4453868 to
f57476c
Compare
3ab5811 to
65ede54
Compare
65ede54 to
c267e2f
Compare
f57476c to
77cf521
Compare
c267e2f to
41cf466
Compare
77cf521 to
211e26c
Compare
211e26c to
bae376b
Compare
41cf466 to
46f30f3
Compare
46f30f3 to
e451e78
Compare
bae376b to
cf126f3
Compare
e451e78 to
751639a
Compare

🌟 What is the purpose of this PR?
During MIR reification,
nullprimitive values and empty tuples were not being lowered to the canonical unit constant(). This meant thatnullliterals and#tuple: []expressions were handled inconsistently compared to other unit-like values. This PR ensures both are promoted toConstant::Unitduring reification, aligning them with the existing treatment of unit expressions.🔍 What does this change?
Primitive::Nullis now matched before the generalPrimitivearm in bothatom.rsandrvalue.rs, lowering it directly toConstant::Unitinstead of falling through to the opaque constant path.Tuple { fields }wherefields.is_empty()) are now lowered toConstant::Unitinrvalue.rsrather than being constructed as a zero-field aggregate.filter-aggressivehave been updated to reflect thatnullcomparisons now display as== ()rather than== nullin MIR output.🛡 What tests cover this?
reify/null-valueverifies that anullliteral is reified as a unit constant.reify/null-value-in-binaryverifies thatnullvalues used in binary expressions (e.g. equality comparisons) are correctly promoted to().reify/empty-tupleverifies that an empty tuple expression is reified as a unit constant.❓ How to test this?
cargo test -p hashql-mirPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR: