Repository navigation
fix(grammar): an empty argument list on a page action or flow data source means no arguments - #1750
Merged
Merged
Conversation
A page action calling a parameterless flow with an empty argument list, `Action: call microflow M.Ping()`, failed check with "mismatched input ')' expecting the start of a statement", while the flow body accepts `()` and the widget accepted the call without brackets (mendixlabs#1606). Cause: microflowArgsV3 in MDLPage.g4 required at least one argument. It is the argument rule of every page action (call microflow/nanoflow, show page and their MDL-DEPR020 spellings) and both flow data sources, so the same error hit Action, OnClick, OnChange, pluggable action properties, alter page set Action/DataSource, navigation and menu-document items, fragment arguments and building-block overrides. fragmentArgs had the same shape; there `use fragment Hdr()` was not even an error without a project: it parsed as two generic widgets (`use` named `fragment`, and `Hdr` with an empty property list), and check -p reported MDL-WIDGET25. Fix: both rules accept an empty list inside the brackets, as the flow body's callArgumentList and workflowCallArguments already do. No visitor change is needed: the builders return nil for no arguments, so `X()` builds exactly the statement `X` builds. Additive, so no mdl-version gate. describe still writes the bracket-less form. The page.action syntax topic and the create-page reference say so; the syntax-docs guard keeps the reference on the describe form with a corrected reason. Verification: - mdl/visitor/visitor_empty_call_args_test.go: 23 sites, X() vs X as whole statements and deprecation codes, a real argument list as the control. Reverting the grammar fails all 23 (22 parse errors, and use fragment on statement equality). - Real 11.13.0 app: a page written with () and its bracket-less twin store identical BSON once $ID and the page name are set aside, and describe identically without brackets; describe -> exec reports Unchanged page; mx check 0 errors. mdl-examples/bug-tests/widget-action-1516-empty-call-args.mdl. - All 81 non-.fail doctype-tests and all bug-tests check as before; only the new bug test changes (fail -> pass). Not changed on purpose: `use building block X()` (an override list) and `snippetcall (Params: ())` (a property map) stay errors with messages that name what is expected; a flow-body call still requires its (). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #1516 (mirror of mendixlabs#1606).
actionbutton … (Action: call microflow M.F())was a syntax error ("mismatched input ')' expecting the start of a statement"), although the same call parses in a flow body and the widget action parses without the brackets.Cause and fix
microflowArgsV3(mdl/grammar/domains/MDLPage.g4) required at least one argument. That one rule is the argument list of all six page-action alternatives (call microflow, call nanoflow, show page, and their MDL-DEPR020 spellings) and both flow data sources, soX()failed at every site that takes an action or a flow data source. It now takesLPAREN ( … )? RPAREN, the shapeworkflowCallArgumentsand the flow-bodycallArgumentListalready have.The sibling
fragmentArgshad the same shape, with a worse symptom:use fragment Hdr()was not a syntax error — the page body's generic widget alternative re-read it as two widgets (typeusenamedfragment, and typeHdr),checkwithout a project passed it, andcheck -p/ exec refused it with MDL-WIDGET25. Same fix.No visitor change:
buildMicroflowArgsV3andbuildFragmentArgsreturn nil for an empty list, soX()builds exactly the ASTXbuilds.describekeeps writing no brackets. The change only lets refused scripts parse, so no language-version gate applies.Audit (
mxcli check,X()baseline → fixed; the bare and with-arguments forms pass both before and after everywhere)X()call microflow/call nanoflow/show page, and the deprecated spellings… X() with (…)/X() returns (…),create object E then show page X()OnClick, textboxOnChange, a pluggable action propertyDataSource: microflow X()/nanoflow X()alter page set Action = … X()/set DataSource = microflow X()OnClickAction:overrideuse fragment Frag()call microflow X()call microflow X;stays an error, on purpose)use building block X(),snippetcall (Params: ())Verified
TestEmptyCallArgumentListMeansNoArgumentscovers 23 sites, comparingX()withXas whole statements (DeepEqual) and their deprecation codes; its control is thatX(arg = …)builds a different statement.TestFlowBodyCallStillRequiresItsBracketspins the flow-body form.use fragmenton statement equality).check -p --referencespasses, exec creates everything, mx check 0 errors. A page written entirely with()and its bracket-less twin store identical BSON (apart from$ID/GUID/name, 7 vs 7ParameterMappings), describe identically, and re-executing the describe output reports "Unchanged page"..faildoctype-tests and 998 bug-tests through both binaries: the only changed result is the new bug-test (fail → pass).go test ./...,go vet, gofmt and CI's doc checks pass with this batch's three branches merged onto main. Bug-testwidget-action-1516-empty-call-args.mdl; finding recorded;mxcli syntax page.actionand docs-site create-page updated.Noticed, not fixed
Whenever a specific page-body rule fails to match, the generic
IDENTIFIERwidget alternative plus an optional empty property list can silently re-read the input as unknown widgets —checkwithout a project passes such pages, and only-preports MDL-WIDGET25. Other near-miss spellings may hit the same trap.🤖 Generated with Claude Code