Skip to content

selfhost: preserve explicit span mutability end to end - #822

Merged
godofecht merged 4 commits into
mainfrom
selfhost/span-mutability-v2
Sep 5, 2026
Merged

godofecht merged 4 commits into
mainfrom
selfhost/span-mutability-v2

Conversation

@godofecht

@godofecht godofecht commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Completes the explicit span<T> / span<mut T> work for #718.

The zero-layout-cost AST_TYPE.c metadata and checked accessors are already present on main. This PR restores the remaining end-to-end slices: flowc_type_name_into emits byte-exact production names span_const_<elem> / span_mut_<elem>, the type-name tests cover both forms, and flowc_parse_type preserves a consumed mut bit only when the outer type identifier is exactly span.

The parser splice is deliberately bounded: arbitrary generic applications still consume mut exactly as before and do not receive span metadata. AstNode layout is unchanged.

Adds the recovered end-to-end parser contract proving real parameters span<i32> and span<mut i32> survive parsing differently and normalize to the expected canonical names.

Maintenance audit 2026-09-02: current main is cb1b7f63ead4446c3f8c8c40351c0d4f53316d56; this branch is 4 commits ahead and 10 behind its merge base d65c3e59…. Current main still contains the explicit type_name.flow fallback saying span mutability is not recorded, so this work has not been superseded. #718 has been reopened accordingly.

Exact next action: refresh this branch against current main locally, resolve drift, run tests/lang/test_parser_span_mutability.flow and tests/lang/test_type_name_port.flow plus the local bootstrap/fixed-point qualification required by generated compiler changes, then record the refreshed head SHA/results before marking ready or merging. Do not use hosted workflows.

Reference sugar (&[T], &mut [T], sized forms) remains separately tracked by #720.

Related: #674 #677 #718 #720 #769 #770 #771

@godofecht

godofecht commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Refreshed against current main and qualified locally, as the maintenance audit asked.

Head: 010ae568, rebased onto main at f033322b plus the merges since.

./flow test --tier2 --strict
All 735 tests passed! (Tier 2)

tests/lang/test_parser_span_mutability.flow and tests/lang/test_type_name_port.flow are both in that run and both pass.

Two things had to be fixed to get there. The new test is the first thing in the tree to import compiler/src/parser.flow, and doing so exposed rhs and name_src: both are declared immutable and assigned later, which --strict rejects. Both are pre-existing on main. They are now let mut.

compiler/bootstrap/flowc_stage_a.c is regenerated so it matches a flowc emit of compiler/src, which is the fixed-point check the audit note asked for.

@godofecht
godofecht force-pushed the selfhost/span-mutability-v2 branch from 010ae56 to b135abd Compare September 5, 2026 19:53
@godofecht

godofecht commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Update after #828 landed.

Head: b135abd6, rebased onto current main.

./flow test --tier2 --strict
All 736 tests passed! (Tier 2)

The type_name.flow commit on this branch is now superseded. #828 carried the span sugar from #720, and its version of that hunk handles & as well as span, so the rebase resolved to main's. What remains here is the parser change plus the two tests.

@godofecht
godofecht force-pushed the selfhost/span-mutability-v2 branch from b135abd to 274f93a Compare September 5, 2026 20:14
@godofecht

godofecht commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Requalified on 274f93a8 after #837 landed.

bootstrap_from_c.sh          exit 0  (fixed point holds, no --regen)
selfcompile_audit.sh         exit 0
self_host_full.sh            exit 0
flow test --tier2 --strict   All 736 tests passed

Marking ready for review.

@godofecht
godofecht marked this pull request as ready for review September 5, 2026 20:27
godofecht and others added 4 commits September 5, 2026 21:41
`rhs` in the pipeline loop and `name_src` in the call builder are both
assigned after their declaration, so under `--strict` the type checker
rejects them. They are reachable only through a test that imports
`compiler/src/parser.flow`, and until this branch added one, nothing did.

The bootstrap C is regenerated so `compiler/bootstrap/flowc_stage_a.c`
matches a flowc emit of `compiler/src` again.

Tier 2 strict: all 735 tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01H7f6FndutYaViuhto1UGA8
@godofecht
godofecht force-pushed the selfhost/span-mutability-v2 branch from 274f93a to 87781f0 Compare September 5, 2026 20:41
@godofecht
godofecht merged commit da1291e into main Sep 5, 2026
22 checks passed
@godofecht
godofecht deleted the selfhost/span-mutability-v2 branch September 5, 2026 20:57
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