Skip to content

Restore trait/impl layout scrambled by 129c4d15 - #1347

Merged
ehartford merged 1 commit into
mainfrom
repair-scrambled-trait-headers
Sep 22, 2026
Merged

ehartford merged 1 commit into
mainfrom
repair-scrambled-trait-headers

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Whitespace-only repair of the layout damage left by 129c4d1 ("Remove legacy equals trait bodies", #385).

What 129c4d1 did

It rewrote every Header = / member(a: T) ... into Header: member(a: / T) ...: the = became :, the newline after the header was dropped, and the last : on the first member line became :\n . It also split impl[T: Bound] into impl[T: / Bound]. No lines were lost and no tokens changed. The parser accepted every scrambled shape (#1346), so the damage stayed in the tree. Other edits in that commit (Parser.w = rejection, render.w, parser_unit_test.w, the two new err_*_eq_body_removed.w tests) are intact.

Still damaged on main, all repaired here (45 files):

  • examples/service: traits.w (4 traits), cache/redis.w, notify/email.w, repo/postgres.w (3 impls)
  • lib/std: builtins.w, collections.w (including impl[T: / Clone]), json.w, traits.w
  • test: 37 files (22 trait sites plus the impl sites), including later copies of the damage in test/d_acceptance/{behav_iter_mut_self,blanket_impl_basic}.w and test/compile_errors/err_iter_of_self_user_constructor.w

The aligned one-line impls in lib/std/traits.w (impl Clone for i8: fn clone(): *self, Debug/Display rows) are deliberate §29.13 Form 1 bodies and are not changed.

How

A With script (split the header at : followed by four spaces; rejoin the continuation line with one space; rejoin impl[T: + bound).

Evidence

  • with tokens, with newline tokens removed, is byte-identical before and after for all 45 files.
  • git diff --word-diff=porcelain shows no added or removed words.
  • Every touched test gives the same result under the installed with before and after. The only differences are diagnostic line numbers and span text, and every //! expectation still matches.
  • examples/service builds, runs (User #1: Alice, exit 0), and with test examples/service/test/service_test.w passes.

Draft until the seed-driven battery is posted.

…e, first member's parameter list rejoined

129c4d1 ("Remove legacy equals trait bodies") rewrote `Header =\n    member(a: T)`
as `Header:    member(a:\n    T)` - the header's newline moved onto the last
`: ` of the first member line - and split `impl[T: Bound]` as `impl[T:\n    Bound]`.
The parser accepted both, so the damage survived in 45 files: 4 examples/service
sources, 4 lib/std modules (builtins, collections, json, traits) and 37 tests,
including copies made later (test/d_acceptance, err_iter_of_self_user_constructor).

Whitespace-only repair by a With script (header split at `:` + four spaces,
continuation line rejoined with one space). The deliberately aligned one-line
impls in lib/std/traits.w (`impl Clone for i8:   fn clone(): *self`) are untouched.

Evidence: `with tokens` streams with newline tokens removed are identical for all
45 files; every touched test gives the same result under the installed `with`
before and after, differing only in diagnostic line/span text; the service
example builds, runs and passes its test.
@ehartford

Copy link
Copy Markdown
Contributor Author

Iterate tier: WITH=$PWD/src/main src/main build :dev rc=0 (200.5s; the first try failed linking against the Xcode 27 SDK's libm.tbd, so it ran with SDKROOT=CLT MacOSX15.4.sdk). stage1 with the repaired stdlib embedded gives the same result as before for all 37 touched tests, and examples/service builds, runs and passes its test. Seven files fail the same way on stage1 when run directly with run, both before (ae609cd base worktree) and after: d_acceptance/{behav_iter_mut_self,blanket_impl_basic} (int_to_string import gate), spec_ss07_5/ss07/ss09_9/ss13_2_iter_one_implementation_rule (link: undefined symbols), spec_ss13_2_iterator_borrowing (D32, known-issue #723). The battery has not run yet.

@ehartford

Copy link
Copy Markdown
Contributor Author

Battery (seed-driven, rebased on main incl. #1339/#1340, 65c7b9f8): build ok, :fixpoint ok, :test ok (no reds), :test-green ok, :last-green ok.

@ehartford
ehartford marked this pull request as ready for review September 22, 2026 22:32
@ehartford
ehartford merged commit 8c859a7 into main Sep 22, 2026
@ehartford
ehartford deleted the repair-scrambled-trait-headers branch September 24, 2026 16: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