Skip to content

engine: per-element equations with no dimensions compile as a scalar #697

Open

Description

@bpowers

A variable with per-element equations but no dimensions is accepted and compiled as a single scalar, with no error.
It should be rejected with an error that names the variable.

Example

The XMILE reader produces this from <element> children with no <dimensions>:

<aux name="arr">
    <element subscript="east"><eqn>SMTH1(driver, 3)</eqn></element>
    <element subscript="west"><eqn>SMTH1(driver, 4)</eqn></element>
</aux>

arr becomes Equation::Arrayed with an empty dimension list, gets a variable size of 1, and compiles.
The same holds for an Equation::ApplyToAll with an empty dimension list.
Exactly which element's equation the scalar ends up computing has not been checked.

Why it matters

A malformed file or a buggy importer gets plausible numbers with no signal.
It was found when a hand-built test fixture of this shape produced all-zero LTM link scores, which looked like an LTM bug.
Not seen in a real model.

Fix

At parse time, reject an Arrayed or ApplyToAll equation with an empty dimension list, naming the variable ("arr has per-element equations but no dimensions").
This also removes a code path that exists only for this shape: the dimensionless case of instantiate_implicit_modules' Ast::Arrayed branch, and its test fixture undimensioned_arrayed_project in db/fragment_determinism_tests.rs.

Pointers

  • src/simlin-engine/src/variable.rs: parse_equation
  • src/simlin-engine/src/xmile/variables.rs: convert_equation! (missing <dimensions> becomes an empty list)
  • src/simlin-engine/src/db/query.rs: variable_size (empty dimensions means size 1)

Activity

  1. added
    engine
    on Jun 3, 2026
  2. changed the title [-]engine: Arrayed/ApplyToAll equation on a variable with no declared dimensions is silently collapsed to scalar instead of rejected[/-] [+]engine: per-element equations with no dimensions compile as a scalar[/+] on Oct 12, 2026
  3. added
    bug
    on Oct 12, 2026
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

    bugengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions