Repository navigation
Flag buttons passing their own data container by widget name (MDL-BUTTON02) - #1013
Merged
Merged
Conversation
…DL-BUTTON02) A button directly inside data view `dvGate` passing `$dvGate` passed `check --references` and `exec`, then `mx check` reported `[CE0117] "Error(s) in expression." at Action button 'btnOwn'`. A data container's widget-name variable is in scope only for the containers nested below it; in its own context the object is $currentObject. The button-context walk now carries the nearest data container's name, moving with the same rule as MDL-BUTTON01 (a control bar takes its context from above its grid), and flags an action argument that reads it. The flagged set matches mxbuild 11.14.0's CE0117s on a ten-button probe: own data view (direct, through a container, from a control bar inside it, as `$dv/Attr`), and a list view, grid or gallery read by its own name from its item or row. The enclosing name from a nested container and a grid's selection from its own control bar build clean and are not flagged. Fixes mendixlabs#1324 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLPboEFUCLXZr6qwX2T9LF
Resolve CHANGELOG.md: keep both sides' Fixed entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLPboEFUCLXZr6qwX2T9LF
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.
Summary
Adds validation rule MDL-BUTTON02 to detect when an action button passes its own data container by widget name (e.g.,
$dvGatefrom insidedvGate), which causes Mendix mxbuild to report CE0117 "Error(s) in expression." This resolves mendixlabs#1324.Key Changes
New validation rule MDL-BUTTON02: Flags action arguments that read a data container's widget name from within that container's own context, where only
$currentObjectis valid$currentObjectinsteadExpression variable detection: Added
exprReadsVariable()helper to identify$variabletokens in action expressions, accounting for string literals and case-insensitive widget name matchingContext tracking enhancement: Extended
checkButtonContextTree()to track the nearest data container (nearestparameter) alongside existing control bar and context state, enabling per-widget validationTest coverage: Added comprehensive test suite (
validate_page_own_container_name_test.go) with three test cases:Documentation: Updated widget reference guide and error cheatsheet; added
.fail.mdltest case for regression detectionImplementation Details
The rule distinguishes between valid and invalid uses:
$dvGatefrom a nested data view/list/gallery insidedvGate$dgSelffrom a control bar of griddgSelf(selection context)$dvGatefrom a button directly insidedvGateor through plain containers$lvInfrom a button directly inside list viewlvInThe validation integrates with existing button context checking and applies to all action types (microflow calls, etc.) and chained THEN actions.
https://claude.ai/code/session_01QLPboEFUCLXZr6qwX2T9LF