Skip to content

engine(vm): scalar SUM(VECTOR ELM MAP(...)) fails VM compilation #367

Description

@bpowers

Problem

A scalar reduction over an array-producing builtin fails VM compilation:

result = SUM(VECTOR ELM MAP(source[*], offsets[*]))

Interpreter evaluation succeeds, but VM compilation fails with:

Cannot push view for expression type Discriminant(7) - expected array expression

Repro

Use a simple model with:

  • source[D] = [10,20,30]
  • offsets[D] = [2,0,1]
  • result = SUM(VECTOR ELM MAP(source[*], offsets[*]))

Then run VM compilation (Simulation::compile() path).

Expected

VM should compile and produce result = 60 (matching interpreter).

Actual

VM compilation errors before simulation starts.

Notes

Discovered while working on issue #364 (nested array-producing builtins in A2A context). This appears to be a separate VM/codegen limitation for scalar reductions over array-producing builtin calls.

Activity

  1. added a commit that references this issue on Mar 1, 2026
    a45bfe7
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions