Skip to content

fix: support @Module.Const syntax in expressions#179

Open
engalar wants to merge 2 commits intomendixlabs:mainfrom
engalar:fix/issue-178-constant-ref-roundtrip
Open

fix: support @Module.Const syntax in expressions#179
engalar wants to merge 2 commits intomendixlabs:mainfrom
engalar:fix/issue-178-constant-ref-roundtrip

Conversation

@engalar
Copy link
Copy Markdown
Contributor

@engalar engalar commented Apr 10, 2026

Fixes #178

Summary

  • Added @QualifiedName as a valid atomicExpression in the MDL grammar for constant references
  • New ConstantRefExpr AST node type for clean representation
  • Visitor converts @ Module.Const parse tree to ConstantRefExpr
  • expressionToString() outputs @Module.Const for BSON serialization
  • Backward compatible: getConstantValue('Module.Const') still works

Round-trip restored

-- DESCRIBE outputs:
DECLARE $val String = @MyModule.MyConstant;

-- Can now be fed back into CREATE without modification ✓

Test plan

  • mxcli check accepts @Module.Const syntax
  • mxcli check still accepts getConstantValue('Module.Const') syntax
  • Full test suite passes
  • Build succeeds

Parser now accepts @QualifiedName as a constant reference in any
expression context (DECLARE, SET, CHANGE, etc.), matching the output
of DESCRIBE MICROFLOW. This restores the round-trip guarantee:
DESCRIBE output can be fed back into CREATE without modification.
…oString

The Executor.expressionToString method in cmd_diff_mdl.go was missing
cases for ConstantRefExpr and QualifiedNameExpr, causing mxcli diff to
output Go struct formatting instead of valid MDL syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constant reference round-trip broken: DESCRIBE outputs @Module.Const but parser rejects @ syntax

1 participant