Repository navigation
Support mixed when/else blocks in case statements - #875
Merged
Merged
Conversation
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix case/when evaluation issues in the parser
Support mixed when/else blocks in case statements
Nov 20, 2025
Owner
|
@copilot there is no need to keep the previous CaseStatement constructor for backward compatibility. |
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
sebastienros
marked this pull request as ready for review
November 20, 2025 17:06
sebastienros
enabled auto-merge (squash)
November 20, 2025 17:07
This was referenced Nov 16, 2026
This was referenced Nov 20, 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.
Case/When Evaluation Issues Fix
This PR fixes the case/when evaluation to support multiple when and else blocks in any order, as described in the issue.
Summary of Changes:
1. New Data Model (
CaseBlock.cs)CaseBlockabstract base classWhenBlockfor when clauses with optionsElseBlockfor else clauses2. Updated
CaseStatement.csElseStatementandWhenStatement[]CaseBlock[]3. Updated
FluidParser.csWhenBlockandElseBlockparsers that can be mixed4. Updated
AstVisitor.csandAstRewriter.cs5. Updated Tests (
CaseStatementTests.cs)WhenBlockandElseBlocktypesVerification:
✅ Issue Example 1 (no match): Returns all else blocks
✅ Issue Example 2 (first whens match): Returns only matched when blocks
✅ All 1356 tests pass
✅ No backward compatibility needed - cleaner implementation
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.