Skip to content

mdl: no test simulates a one-parameter macro call #553

Closed

Description

@bpowers

A one-parameter Vensim macro call such as PEAK(sales) now reaches macro resolution (#1076), but no test simulates one, and many comments still say such a call becomes a table lookup.
The importer used to rewrite every one-argument call NAME(x) as LOOKUP(NAME, x); it now does so only when NAME is a variable the model defines (calls_a_table).

Existing one-parameter fixtures (DOUBLE(3), DBL(...), LAGSUM(driver)) check only import text or names, not values.
Several macro tests still use two parameters to dodge the old rewrite.

One-parameter macros are common in real models: PEAK(x) in the metasd beer game (RealBeer4-Sterman13.mdl), SSHAPE(input) and others.

Fix

  • Add a one-parameter macro row to the macro simulation tests in tests/integration/simulate.rs, checking its value.
  • Delete the stale "1-arg call becomes LOOKUP" comments: tests/integration/simulate.rs (near lines 5609, 5740, 5976, 6058, 6211), src/module_functions.rs:1445, src/macro_expansion_tests.rs:795, test/test-models/tests/macro_clearn_sshape/README.md (lines 13, 44).

Pointers

  • src/simlin-engine/src/mdl/xmile_compat.rs: calls_a_table

Activity

  1. added
    engine
    compat
    on Jun 8, 2026
  2. changed the title [-]engine: single-parameter Vensim macro invocation is silently rewritten to LOOKUP on MDL import[/-] [+]mdl: a one-parameter macro call is read as a table lookup[/+] on Oct 12, 2026
  3. added
    bug
    on Oct 12, 2026
  4. changed the title [-]mdl: a one-parameter macro call is read as a table lookup[/-] [+]mdl: no test simulates a one-parameter macro call[/+] on Oct 12, 2026
  5. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: fixed on main. The rewrite to LOOKUP applies only when the name is a declared table (calls_a_table); 12b1df5 adds simulates_one_parameter_macro_calls, which simulates one-parameter macro calls and a one-argument table call, and removes the stale comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompatengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions