Skip to content

engine: a many-to-one element map reference failed to compile #753

Closed

Description

@bpowers

An apply-to-all reference through a many-to-one element map (more elements in the equation's dimension than in the referenced variable's) failed to compile with "failed to compile fragments for variables: target".

Example

State{s1,s2,s3} mapped to Region{a,b} with s1 -> a, s2 -> a, s3 -> b (the simlin:mapping / simlin:elem extension).
x[Region], and target[State] = x[State] * c.
Expected target[s1] = x[a], target[s2] = x[a], target[s3] = x[b]; reported a compile error.
Aggregating states into regions is the usual reason to write such a map.

Current state

On main this compiles and reads through the map.
src/simlin-engine/src/mapped_reference_semantics_tests.rs covers it as the ManyToOne row (three target elements over two source elements read [10, 20, 10]), and the reverse 2-to-3 case as ReverseCardinality, for every reference spelling and with the map declared on either dimension.
Landed in PR #1010.

Pointers

Activity

  1. added
    bug
    engine
    on Jun 10, 2026
  2. bpowers commented on Jun 10, 2026

    @bpowers
    OwnerAuthor

    Sibling issue filed: #756 -- same-cardinality (permutation) element maps DO compile, but the executed A2A lowering ignores the map and resolves positionally, producing silent wrong results. The positional-only execution there is consistent with the different-cardinality compile failure here; a per-element-indirection fix for #756 likely generalizes to resolve this issue too.

  3. changed the title [-]engine: different-cardinality element-map reference fails to compile (failed to compile fragments)[/-] [+]engine: a many-to-one element map reference fails to compile[/+] on Oct 12, 2026
  4. changed the title [-]engine: a many-to-one element map reference fails to compile[/-] [+]engine: a many-to-one element map reference failed to compile[/+] on Oct 12, 2026
  5. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    PR #1010 (0140175) added src/simlin-engine/src/mapped_reference_semantics_tests.rs; expected (line ~575) requires the ManyToOne row (3 State onto 2 Region) to read [10, 20, 10] and ReverseCardinality to read [30, 10], and every_cell_of_the_matrix (line 643) runs both through TestProject -> salsa -> VM for all four spellings (x[State], x[Region], bare x, stock flow) with the map declared on either dimension.

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