Skip to content

Support per-field mutability and record field bounds - #625

Closed
LPTK wants to merge 1 commit into
hkust-taco:codex/pr575-inference-basefrom
LPTK:codex/pr575-mutable-record-syntax
Closed

LPTK wants to merge 1 commit into
hkust-taco:codex/pr575-inference-basefrom
LPTK:codex/pr575-mutable-record-syntax

Conversation

@LPTK

@LPTK LPTK commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

[GPT-6 Astra]

Record literals can declare individual mutable fields with {mut field: value}, and mutable record interfaces can spell distinct write/read bounds directly as {mut field: in S out T}. The read/write constraint model is supplied by #575; this PR adds the declaration syntax and threads its mutability through cloning, lookup, interface exposure and runtime allocation.

Type arguments and field bounds share elaboration. Tests cover per-field and whole-record mutability, spread copies, explicit and omitted bounds, negative positions, aliases, recursive fields, structural and nominal callback writes, and cloning. The language reference documents the syntax and its limits.

This extracts E33–E34 from #575: 132 changed compiler Scala lines across eight files, plus eight Scala test adaptation lines in one file, documentation and diff-test updates.

Merge after #575. The temporary base codex/pr575-inference-base mirrors reduced #575 at f74e393f5 so this PR shows only the syntax feature. After #575 merges, integrate updated hkmc2 into this branch and retarget the PR to hkmc2; this also reconciles ancestry if #575 is squash-merged. It is independent of the deforestation follow-up #624.

Extract E33–E34 after the shape-inference core, preserving its existing whole-record mutable-field constraints. Thread per-field mutability through elaboration, cloning, lookup, exposure and allocation; share input/output-bound elaboration with type arguments.

Validation: Metals compilation and hkmc2AllTests/test (1,294 tests); reference documentation and regenerated golden outputs included.
@LPTK LPTK added the slopfest label Nov 7, 2026
@LPTK
LPTK deleted the branch hkust-taco:codex/pr575-inference-base November 9, 2026 08:02
@LPTK LPTK closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants