Repository navigation
Preserve the ELSE branch when serializing IF statements - #2971
Merged
Merged
Conversation
yy.If.prototype.toString wrote thenstat after ELSE, so IF FALSE SELECT VALUE 1 ELSE SELECT VALUE 2 serialized as IF FALSE SELECT VALUE 1 ELSE SELECT VALUE 1. Use elsestat instead and add a regression test that checks the full serialized SQL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Love it. Thank you! |
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.
Serializing an
IFstatement repeats the THEN statement afterELSE, soand running the serialized SQL gives a different result from the original.
yy.If.prototype.toStringinsrc/68if.jsusedthis.thenstatfor the ELSE branch; it now usesthis.elsestat.A new case in
test/test206.jschecks the full serialized string. It fails without the fix and passes with it. Withsh build.shandyarn test-only, the whole suite passes (2556 pass, 0 fail), and Prettier is clean on both files.CASEserialization has a related problem, but #2675 and #2750 hold expression-text changes for 5.0, so it is left out here.Prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.
🤖 Generated with Claude Code