Repository navigation
fix(check): refuse a list retrieved over an association used as an object (mendixlabs/mxcli#1516) - #1425
Merged
Conversation
…ject (mendixlabs#1516) `retrieve $L from $h/M.Line_Header` from the TO entity of a Reference (the "one" side) binds a LIST. Using it as an object -- `$L/Qty`, `change $L`, passing it to an object parameter -- passed check --references and exec, then mx check failed with CE0117 / CE7247 (measured identically on 11.6.6 and 11.15.0; the bare list retrieve, count and loop build clean on both). MDL-RETRIEVE03 only seeded database retrieves: list-vs-object over an association needs the association's type, owner and which end the start variable is. The decision now lives in associationRetrieveYieldsList, used by the flow builder and by a new --references pass that tracks each object variable's entity, resolves the start end (script + project associations, generalization chain) and reports member-path, change and object-parameter use of the list under MDL-RETRIEVE03, through the walk the no-project rule now shares. Owner Both (one-to-one) and the FROM side stay objects. MDL043: with a project or a script that creates it, a bare declare type that is an enumeration is not an object declare -- exec writes it as the enumeration variable and it builds (11.15.0). It now warns with describe's `enum` spelling instead of refusing it with the object wording. Docs: microflow.variables documents the conditional-create idiom (one create with conditional values, or a sub-microflow returning per branch; the same name created in both branches is CE0111 on 11.15.0) and the enum declare; microflow.retrieve and the error reference describe association list results; MDL063's suggestion names the idiom for a create. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
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 mendixlabs#1516 (#1398).
Measured first (11.15.0 and 11.6.6 identical)
Line→Header Reference, retrieved from the Header (the "one" side):
retrieve $L from $h/Tmp.Line_Header;unused (the issue's literal repro)$n = count($L)declare $n Integer = $L/Qtychange $L (Qty = 5)call microflow Tmp.Sub(line = $L)(Sub takes one Line)So the bare list retrieve and
countare fine on 11.15 too. The build fails only once the list is used as an object, and that is whatcheckpassed.1. Object use of an association list
associationRetrieveYieldsList(refSet, ownerBoth, fromToSide), used by both the builder and the new check.validateAssociationRetrieveListUse, incheck -p,--referencesand exec preflight:change, or passing the list to a single-object parameter, as MDL-RETRIEVE03.retrieve … where [Assoc = $h] first;orhead/loop; both measured clean.flowParamgained aListfield.2. MDL043 on an enumeration declare
declare $X Tmp.SomeEnum = empty, with the enumeration in the project, builds at 0 errors on 11.15. Describe printsdeclare $X enum Tmp.SomeEnum = empty, so MDL043 was refusing a valid script.-p, for an entity, or for a name that is both, it stays the object error. Its hint now mentionsenum X.3. Docs
mxcli syntax microflow.variables: the conditional-create idiom and theenumdeclare spelling. Measured on 11.15: creating the same name in both branches is CE0111. The forms that build are one create withif … then … elsevalues, or a sub-microflow that returns the object.microflow.retrieve: a note on what an association retrieve returns.error-messages.mdand the cheatsheet-variables skill.Tests
TestAssociationRetrieveListUsedAsObject: 5 failing shapes and 5 controls.TestAssociationRetrieveYieldsList.TestMDL043_EnumerationNamedBare: 2 cases and 3 controls.TestMDL063_ConditionalCreateNamesTheIdiom.Revert check:
mx check:
make build,make test,make lint,make check-findingsandmake check-skill-mdlpass. A finding file andmdl-examples/bug-tests/1516-retrieve-list-over-association.mdlare included.For review
$Land the callee's signature resolves.🤖 Generated with Claude Code
https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
Generated by Claude Code