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
rsscript: struct field defaults (construction helpers)
A struct field may declare a default value (`name: T = expr`); a constructor call
may omit it and it is filled — the construction-helper analog of default function
parameters.
- AST/parser: FieldDecl.default, parsed by splitting the field on `=`.
- FieldInfo.default flows into the constructor's ParamSig.default, so the existing
HIR default-fill handles the VM/checker path (no RS0204 on omitted defaults).
- Compiled backend: the struct-literal lowering fills omitted defaulted fields.
- Formatter: renders `= <expr>` on fields (was silently dropped) + round-trip test.
Verified at VM/compiled parity (eval + run both print the filled defaults).
Test: tests/fixtures/pass/struct-field-defaults.rss. lib/frontend/lowering green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments