Skip to content

fix: SET $obj/Module.Assoc = $other rejected — isVariableDeclared does not handle path-style targets #511

@ako

Description

@ako

Bug

SET $obj/Module.Assoc = $other inside a microflow body fails validation with:

variable 'obj/Module.Assoc' is not declared

The in-CREATE form works fine:

create object $obj of MyModule.Order (
  MyModule.Order_Customer = $customer
);

Root cause

The grammar and parser both support association paths as SET targets (attributePath rule in MDLParser.g4). The parser captures the full path string obj/Module.Assoc into MfSetStmt.Target.

The failure is in isVariableDeclared (mdl/executor/cmd_microflows_builder.go), which does a direct map lookup using the full path string. Only the bare variable name obj is registered in varTypes. The function does not extract the variable prefix before looking up.

The fix: strip the path suffix (everything from the first / or .) before doing the map lookup in isVariableDeclared.

Reproduction

create microflow MyModule.ACT_LinkCustomer (
  $order: MyModule.Order,
  $customer: MyModule.Customer
)
begin
  -- This fails:
  set $order/MyModule.Order_Customer = $customer;
  return;
end;

Affected files

  • mdl/executor/cmd_microflows_builder.goisVariableDeclared function
  • mdl/executor/cmd_microflows_builder_actions.go — call site (addChangeVariableAction)

Related

Also add a doctype test or bug test in mdl-examples/bug-tests/ covering this case so it doesn't regress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions