Fix: AST Builder maps div to DIVIDE instead of TRUNCATED_DIVIDE#1705
Merged
Fix: AST Builder maps div to DIVIDE instead of TRUNCATED_DIVIDE#1705
Conversation
The CQL `div` operator (truncated integer division) was mapped to BinaryOperator.DIVIDE (same as `/`), meaning the AST lost the distinction between `/` (true division) and `div` (truncated division). - Add TRUNCATED_DIVIDE to BinaryOperator enum - Map `div` to TRUNCATED_DIVIDE in Builder - Fix existing test assertion that incorrectly expected DIVIDE for div Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Related IssuesThe following open issues may be related to this PR:
|
|
Formatting check succeeded! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1705 +/- ##
=========================================
Coverage 61.97% 61.97%
Complexity 3940 3940
=========================================
Files 210 210
Lines 20366 20366
Branches 3879 3879
=========================================
Hits 12621 12621
Misses 6138 6138
Partials 1607 1607 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
lukedegruchy
approved these changes
Mar 16, 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
divoperator (truncated integer division) was mapped toBinaryOperator.DIVIDE(same as/) in the AST Builder, losing the distinction between true division and truncated division.TRUNCATED_DIVIDEto theBinaryOperatorenum.BuilderExpressionTestassertion that incorrectly expectedDIVIDEfordiv.Note: This only affects the AST Builder (new pipeline). The legacy
Cql2ElmVisitoralready correctly emitsTruncatedDividefordiv.Test plan
BuilderExpressionTestupdated to assertTRUNCATED_DIVIDEfor5 div 2🤖 Generated with Claude Code