Skip to content

Vec range slice v[..] as a call argument lowers to a Unit operand (invalid MIR before codegen) #1632

Closed

Description

@ehartford

Found while writing the D64 buffer-pairing fixtures (test/behavior/behav_c_facade_buffer_input.w).

Repro:

fn take(b: []u8) -> i32: b.len() as i32
fn main:
    var v: Vec[u8] = Vec.new()
    v.push(1)
    print(take(v[..]))

Actual: error: invalid MIR before codegen: call argument 0 is Unit but the callee parameter is not.
Expected: the same []u8 view that take(v) (the #604 coercion) and arr[..] on an array produce (spec §4.8a: "slice of entire array").

Workaround used in the fixture: pass v and let the call-site coercion slice it.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions