You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lang): default parameter values (tinygrad port item)
Support `fn f(a: Int, b: Int = 2)` — a call may omit a trailing parameter that
declares a default; the default is filled in at lowering so every backend sees a
complete positional call (Rust has no default params). Removes the manual
overload/wrapper sets the tinygrad port needed for Python-style defaults.
- AST: `Param.default: Option<Expr>`; parser splits `name: Type = <expr>`.
- HIR: `ParamSig.default`; the call builder fills omitted defaulted params (VM).
- compiled backend: a parallel `function_param_defaults` map + `callee_source_name`
fill omitted trailing defaults in the lowered Rust call.
- checker: a still-missing *required* arg reports RS0204; the default value is
type-checked against the parameter type (RS0207 on mismatch) — both fall out of
desugaring the default into a normal call argument.
- formatter: emits `= <default>` (reformatting is lossless/idempotent).
Tests: pass fixture, VM/compiled parity (`parity_default_arguments_*`), formatter
round-trip, and the missing-required / wrong-typed-default diagnostics. Full
suite (1017) green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments