Skip to content

engine: no test for SUM(m[*]) on a 2-D array in apply-to-all #781

Open

Description

@bpowers

SUM(m2[*]) on a two-dimensional m2, inside an apply-to-all equation, used to fail with a generic "failed to compile fragments" error instead of a diagnostic at the reference.
The code on main should now report it, but no test runs this shape.

Example

TestProject::new("repro")
    .named_dimension("d1", &["a", "b"])
    .named_dimension("d2", &["c", "d"])
    .array_aux("m1[d1,d2]", "1")
    .array_aux("m2[d1,d2]", "2")
    .array_aux("two_mixed[d1]", "SUM(m1[d1,*]) + SUM(m2[*])")

Expected: a MismatchedDimensions error on two_mixed at m2[*] naming d2.
The correct spelling, SUM(m1[d1,*]) + SUM(m2[*,*]), should simulate.

Since #1087, a reference with fewer subscripts than dimensions is rejected in lower_subscript with that diagnostic, but the only test is the scalar w[north] * 2.
Whether a wildcard under a reducer in an apply-to-all equation reaches that check has not been confirmed.

Constructed while writing LTM fixtures; not seen in a real model.

Fix

Add the repro and its [*,*] counterpart as rows in mismatched_read_tests.rs, and fix whatever they show.

Pointers

  • src/simlin-engine/src/compiler/context.rs: lower_subscript
  • src/simlin-engine/src/mismatched_read_tests.rs: a_reference_subscripted_on_fewer_dimensions_names_the_rest

Activity

  1. added
    bug
    engine
    on Jun 11, 2026
  2. changed the title [-]engine: mixed-arity multi-source reducer fails fragment compile (SUM(m1[d1,*]) + SUM(m2[*]) with 2-D m2)[/-] [+]engine: SUM(m[*]) on a 2-D array gave a generic compile failure[/+] on Oct 12, 2026
  3. changed the title [-]engine: SUM(m[*]) on a 2-D array gave a generic compile failure[/-] [+]engine: no test for SUM(m[*]) on a 2-D array in apply-to-all[/+] 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