Skip to content

MIR: a pipeline stage call omits the callee's default arguments (invalid LLVM: wrong argument count) #2024

Closed

Description

@ehartford

Found while implementing D86 (#1864).

Spec: a default parameter value fills a missing argument in every call spelling; a pipeline stage x |> f() is the call f(x) (§ pipelines).

Repro:

fn show(n: i32, label: &str = "n") -> Unit:
    print(f"{label}={n}")
fn main:
    3 |> show()

Expected: prints n=3.
Actual: Incorrect number of arguments passed to called function! ... LLVM function verification failed after MIR cleanup for main; code generation failed.

Root: MirLower.w lower_pipeline builds [lhs] ++ explicit args and calls lower_call_with_arg_nodes, which never fills the declaration's defaults (lower_call does, through Sema's resolved args or the decl's get_fn_param_default + lower_default_call_arg, which gives src() the call site). The precondition forms' pipeline spelling (c |> require(msg)) is handled by D86's lowering; every other callee with defaults still hits this.

Workaround: none needed in the tree; spell the call show(3).

Activity

  1. added
    bug
    on Oct 3, 2026
  2. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed in #2035 (draft): Sema fills the argument list for a positional call that leaves parameters to their defaults (and for a bare stage on the pipeline node), and lower_pipeline lowers that list. It also stops the in-pipeline flag leaking into calls among a stage's arguments.

  3. added 2 commits that reference this issue on Oct 3, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions