You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support inheritance split and cast statements
Symptom: type-based microflow decisions and cast actions could be read from MPRs but had no first-class MDL representation, so describe/exec round-trips could not preserve InheritanceSplit and CastAction graphs.
Root cause: the microflow AST, grammar, visitor, builder, describer, validator, and MPR writer only modeled boolean exclusive splits and regular actions. InheritanceCase sequence flows and CastAction BSON were not emitted back to valid project data.
Fix: add split type and cast statements, parse and build inheritance branches, describe existing InheritanceSplit graphs by resolving case entity names, serialize inheritance split/case/cast BSON, and recurse through type-split bodies in validation/reference/layout code.
Tests: added parser, builder, describer, terminality, validation, and MPR writer regressions plus a doctype fixture checked with mxcli check. Also ran make build, make lint-go, and make test.
# Proposal: Microflow Inheritance Split And Cast Statements
2
+
3
+
Status: Draft
4
+
5
+
## Summary
6
+
7
+
Add round-trip MDL support for type-based microflow decisions and cast actions:
8
+
9
+
```mdl
10
+
split type $Input
11
+
case Sample.SpecializedInput
12
+
cast $SpecificInput;
13
+
else
14
+
return false;
15
+
end split;
16
+
```
17
+
18
+
## Motivation
19
+
20
+
Studio Pro represents specialization/type decisions as `InheritanceSplit` objects and stores downcasts as `CastAction` activities. Without first-class MDL statements, `describe` can only emit unsupported comments or incomplete split output, and `exec` cannot rebuild the same graph.
21
+
22
+
## Semantics
23
+
24
+
`split type $Var` evaluates the runtime specialization of an object variable. Each `case Module.Entity` branch corresponds to an outgoing sequence flow with an `InheritanceCase`. The optional `else` branch maps to the outgoing flow without an inheritance case.
25
+
26
+
`cast $Output` emits a `CastAction` that produces the downcast variable. `$Output = cast $Input` is accepted for source-preserving authoring, but current Mendix BSON stores the generated cast variable as the primary persisted field.
27
+
28
+
## Tests And Examples
29
+
30
+
`mdl-examples/doctype-tests/inheritance_split_statement.test.mdl` demonstrates the syntax. Go regression tests cover parser construction, builder output, describer output, validation recursion, and BSON writer support for inheritance case values and cast actions.
31
+
32
+
## Open Questions
33
+
34
+
- Should `exec` validate `case Module.Entity` against the project's specialization hierarchy when connected?
35
+
- Should the source-preserving `$Output = cast $Input` form round-trip both variable names once the underlying BSON fields are confirmed for all supported Mendix versions?
Copy file name to clipboardExpand all lines: docs/11-proposals/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,7 @@ BSON schema Registry ◄──── multi-version Support
52
52
|[XPath Gaps](xpath-gaps-proposal.md)| Partial | XPath constraint support gap analysis. ~85% complete, association paths and nested predicates remain | — |
0 commit comments