Skip to content

#2024: pipeline stage calls get the callee's default arguments; #2026: comptime evaluator pattern lets and aggregate layout, and the driver says when an action runs in it - #2035

Merged
ehartford merged 2 commits into
impl-1864from
fix-2024
Oct 3, 2026

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

#2024: a pipeline stage drops the callee's default arguments

  • Sema states the filled list (D65). resolve_named_call_args now fills the argument list for a positional call that leaves trailing parameters to their defaults. Before, it did this only for named-argument calls. A bare stage x |> f gets its list on the pipeline node.
  • MIR lowers that list. lower_pipeline lowers the piped value first, then Sema's list, through lower_call_with_arg_nodes_recv, which now reads the defaults from the node Sema stated them on. A src() default is the stage call's location. Before, the stage passed only the piped value and the explicit arguments, which produced invalid LLVM (wrong argument count).
  • Piped value reached nested calls. The in-pipeline flag leaked into calls among the stage's arguments, so x |> f(g()) reported g as given one argument too many. The piped value is now only the stage call's first argument.
  • Fixture: test/behavior/pipeline_stage_default_args.w. It covers x |> f(), x |> f(a), a src() default, a bare stage, and a call among the stage's arguments. It failed on the base compiler with invalid LLVM, and before that with the arity error.
  • The precondition-form pipeline lowering in D86 (#1864): assert/require/check are compiler-known forms; the message is evaluated only on failure #2030 (D86) is not on this branch. It is still needed for laziness, but once both land it can read this list instead of filling the defaults itself.

#2026: :contract-view-tests red under --no-deps

  • The full invocation is green. Both WITH=$PWD/src/main src/main build :contract-view-tests (pinned seed, clean origin/main) and with build :contract-view-tests (installed compiler, clean origin/main) pass through the native runner.
  • The red was --no-deps over an out/lib of another compiler generation. In that case the runner is not linked (Pinned darwin seed (607a52f5, 09-25) predates #1720: it links the native build runner against a stale out/lib, the runner fails, and the driver's silent comptime fallback then fails the build (no stage1 ever ran) #1797), and the action silently ran in the driver's comptime evaluator, which then failed. Two evaluator defects, fixed here:
    • NK_LET_ELSE (let (rc, audit) = ...) was not evaluable. eval_let_pattern now binds the pattern, or runs its else.
    • eval_tuple and eval_array recorded where their elements start before evaluating them. An element whose evaluation laid out extra values first (a capability call's arguments, a nested aggregate) shifted every element after it. (result.rc, ctx.fs().read_text(p)) read back p, so every needle check failed. A wrong result, not a refusal.
  • The driver now says so. It prints a note, once, when an action runs in the evaluator and why.
  • With the fixed stage1 as driver, :contract-view-tests --no-deps over a foreign-generation out/lib passes: 14 fixtures, all agreed, with the note printed. The pinned seed keeps the old evaluator until the next reseed.
  • Fixtures: test/behavior/comptime_let_pattern.w and test/behavior/comptime_aggregate_nested_elements.w. Both failed on the base compiler.

Verification

  • src/main build :gate: green.
  • :deep-debug-tool-tests: green.
  • :drop-audit: 254 cells, 0 regressions.
  • --validate-all and analyze audit:all are clean on the pipeline fixture.

Eric Hartford added 2 commits October 3, 2026 05:01
…a states the filled list

Sema (resolve_named_call_args) now fills the argument list for a
positional call that leaves trailing parameters to their defaults, as it
did only for named-argument calls; a bare stage `x |> f` gets its list on
the pipeline node. MirLower.lower_pipeline lowers that list (the piped
value first) through lower_call_with_arg_nodes_recv, which reads the
defaults from the node Sema stated them on; a src() default is the stage
call's location. Before, the stage call passed only the piped value and
the explicit arguments: invalid LLVM (wrong argument count).

Also: the piped value is the stage call's first argument only. The
in-pipeline flag reached calls among the stage's arguments, so
`x |> f(g())` reported g as given one argument too many.


D86's precondition forms (lower_precondition_form, #1864) read the same
list: their own walk of the declaration's parameter defaults is deleted,
and a form call whose operands do not cover the signature is a Sema
phase bug.
…ements out correctly

`src/main build :contract-view-tests --no-deps` over an out/lib of another
compiler generation does not link the native runner (#1797), so the
action ran in the driver's evaluator, silently, and failed there:
- NK_LET_ELSE (`let (rc, audit) = ...`) was not evaluable;
  eval_let_pattern binds the pattern, or runs its else.
- eval_tuple / eval_array recorded the run's start before evaluating the
  elements, so an element whose evaluation pushed extra values (a
  capability call's arguments, a nested aggregate) shifted the run:
  `(result.rc, ctx.fs().read_text(p))` read back `p`, and every needle
  check failed.
The full invocation (runner) was green throughout.

The driver's note on why an action runs in the evaluator is main's
build_runner_explain_no_root (#1906), which landed first.
@ehartford
ehartford marked this pull request as ready for review October 3, 2026 15:13
@ehartford
ehartford merged commit 67c445b into main Oct 3, 2026
@ehartford
ehartford deleted the fix-2024 branch October 3, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant