fix(microflows): preserve ELSIF arms by lowering to nested IfStmt (#745)#746
Draft
mlehane1 wants to merge 1 commit into
Draft
fix(microflows): preserve ELSIF arms by lowering to nested IfStmt (#745)#746mlehane1 wants to merge 1 commit into
mlehane1 wants to merge 1 commit into
Conversation
buildIfStatement read only exprs[0]/bodies[0] and the trailing ELSE body, so every middle (ELSIF expression THEN microflowBody)* pair from the grammar was silently dropped from the written model — check and exec reported success and mx check was clean, making the data loss invisible. Mendix has no native elsif construct, so lower each ELSIF arm into a nested IfStmt in the ELSE branch of the arm before it (built innermost first) — the canonical nested-exclusive-split shape. Plain IF/ELSE builds exactly as before. Verified end-to-end: exec of the bug-test script against a fresh 11.11.0 app, DESCRIBE round-trips all arms as nested if/else, mx check 0 errors. go test ./mdl/... ./sdk/... green.
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.
Fixes #745.
What
buildIfStatement(mdl/visitor/visitor_microflow_statements.go) read onlyexprs[0]/bodies[0]and the trailing ELSE body, so every middle(ELSIF expression THEN microflowBody)*pair from the grammar was silently dropped from the written model —checkandexecreported success andmx checkwas clean, making the data loss invisible.Mendix has no native elsif construct, so this lowers each ELSIF arm into a nested
IfStmtin the ELSE branch of the arm before it (built innermost-first) — the canonical nested-exclusive-split shape Studio Pro users build by hand. Plain IF/ELSE builds exactly as before (regression-guarded).Validation
mdl/visitor/visitor_microflow_elsif_test.go): elsif chain preserved with conditions/bodies at each level; elsif-without-else (innermost arm has no ELSE); plain if/else unchanged (no gratuitous nesting). Written failing-first against the old visitor.mdl-examples/bug-tests/745-elsif-arms-dropped.mdl— exec against a freshmxcli new11.11.0 app, thenDESCRIBE MICROFLOW BugTestElsif.MF_Gradeshows all four arms (one/two/three/other) as a nested if/else chain with sensible auto-layout positions.mx check= 0 errors on the resulting app (Windows, mx 11.11.0).go test ./mdl/... ./sdk/...green;go vet ./mdl/...clean (grammar regenerated with ANTLR 4.13.1)..mprapps..claude/skills/fix-issue.mdper the bug-fix checklist.Opened as a draft pending maintainer sign-off on #745 per CONTRIBUTING.md.
🤖 Generated with Claude Code