Conversation
Related IssuesThe following open issues may be related to this PR:
|
|
Formatting check succeeded! |
a845233 to
91169fd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1706 +/- ##
============================================
- Coverage 61.97% 61.96% -0.01%
Complexity 3940 3940
============================================
Files 210 210
Lines 20366 20367 +1
Branches 3879 3879
============================================
Hits 12621 12621
- Misses 6138 6139 +1
Partials 1607 1607 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…eclaration When a CQL file has no `library` declaration and uses DateTime constructors, Chunk.addChunk() throws IllegalArgumentException because the child chunk's source interval falls outside the parent's bounds. This exception is caught by the generic error handler in CqlPreprocessorElmCommonVisitor.visit(), which records it as a compilation error and replaces the expression with Null — silently dropping the statement from ELM output. Root cause: forward reference or function resolution during expression processing can produce chunks with intervals that extend beyond the library chunk's original interval. The require() in addChunk was too strict for a best-effort annotation/narrative system. Fix: expand the parent chunk interval to accommodate the child rather than failing. The chunk system supports source annotation and narrative generation — it should not block compilation. Repro: 3-statement CQL without library declaration using DateTime(). Before: 1 statement emitted, 1 error. After: all 3 statements emitted, no errors. Also fixes OperatorTests/DateTimeOperators.cql (was: 1/71, now: 71/71). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
91169fd to
51a178f
Compare
c-schuler
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
When a CQL file has no
librarydeclaration and usesDateTime()constructors, the translator's chunk tracking fails after the first expression definition with:All subsequent statements are silently dropped from the ELM output. For example,
OperatorTests/DateTimeOperators.cql(71 define statements) produces only 1 statement in the ELM.Repro
Minimal CQL file (no library, no using, no context):
Expected: 3 statements in ELM, no errors
Actual: 1 statement (
First), 1 error ("Child chunk cannot be added...")Test plan
ChunkErrorTestreproduces the bug — asserts all 3 statements emitted and no errors🤖 Generated with Claude Code