Repository navigation
Parser: trait/impl/extend bodies take exactly the three §29.13 body forms (#1346) — re-land of #1357 onto main - #1400
Merged
Conversation
ehartford
force-pushed
the
fix-1346-trait-impl-body-forms
branch
from
September 23, 2026 01:54
16f97a3 to
194d7e1
Compare
ehartford
marked this pull request as draft
September 23, 2026 01:56
Contributor
Author
|
Battery (seed-driven) on main 00408eb + #1400 → #1370 → #1371 → #1397 as one chain (head 37a2441): build ok, :fixpoint ok, :test ok (no reds), :test-green ok, :last-green ok. Each branch holds exactly its tested commit on top of the previous PR's; all target main. Merge in order #1400, #1370, #1371, #1397. |
ehartford
marked this pull request as ready for review
September 23, 2026 02:54
This was referenced Sep 23, 2026
Merged
…orms (#1346) parse_trait_decl and parse_impl_block treated ':' as optional punctuation, skipped newlines, and collected members until one started at column 0, so an inline first member followed by indented members was one body, and a bodyless `impl Foo for X` (§2.3) swallowed the indented `fn` lines after it. Both now name the body form once (parse_decl_body_introducer) and read member boundaries from it (decl_member_continues): - Form 1 (':' then content): one member; a second is reported ("an inline trait body is a single member ...", fix-it: end the line after the header and indent the first member). Newlines inside the member's parentheses stay part of it. - Form 2 (':' ends the line): members indented deeper than the header line; nothing indented below is "expected an indented trait body after ':'", as for `fn f:`. - Form 3 (braces): members separated by newlines or semicolons (semicolons were rejected before). - impl/extend with no introducer is bodyless and ends at its newline; indented lines after it are reported with the fix-it `impl Foo for X:`. Any other token after an impl header is "expected ':' or '{' after the impl header" (it used to fall through silently). Sweep: every .w under src lib rt tools test examples build build.w parsed with the installed compiler and this stage1; no file changes verdict except the new fixtures and files that use syntax newer than the installed compiler. (cherry picked from commit 7aff486) (cherry picked from commit 225ea6ed80a74de2a10e312b4fc7e91d61cde028)
ehartford
force-pushed
the
fix-1346-trait-impl-body-forms
branch
from
September 23, 2026 02:56
194d7e1 to
a1e3926
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-land of #1357. #1357 was stacked on #1355's branch and merged into that branch after #1355 had already merged, so its commit never reached main (
parse_decl_body_introduceris absent from origin/main 00408eb). Same commit (16f97a3), tested in the batch battery on dd786a4 with #1355/#1370/#1371 (all green; see #1357). The branch also carries #1355's pre-squash commit 3786a9c, whose content is already on main as 1f4636d — identical changes, so the merge is clean and the net diff is #1346 alone.Fixes #1346