Skip to content

SPEC: formalize trailing-; semantics (ILO-405)#666

Merged
danieljohnmorris merged 2 commits into
mainfrom
docs/trailing-semi-spec
May 22, 2026
Merged

SPEC: formalize trailing-; semantics (ILO-405)#666
danieljohnmorris merged 2 commits into
mainfrom
docs/trailing-semi-spec

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a Trailing-semicolon semantics section to SPEC.md (in the Functions chapter, after Inline lambdas) formalizing when ; is required, optional, or silently consumed
  • Documents all three body contexts: top-level function bodies, inline-lambda bodies ((params>return;body)), and match/guard arm bodies
  • Includes a table, practical rules, and a note on the one case that is an error (double-; at statement start)
  • Adds tests/regression_trailing_semi.rs with 5 tests pinning the behavior

What was formalized

Context Finding
Function body f>n;42; Trailing ; silently consumed — identical to f>n;42
Inline lambda (x:n>n;+x 1;) Trailing ; before ) silently consumed
Match arm ?x{1:10;_:20;} Trailing ; before } silently consumed
Header separator name params>return;body The ; separating the return type from the body is optional when a newline is present
Double-semicolon f>n;;42 Parse error — trailing-; consumption only applies after a valid statement

Test plan

  • fn_body_trailing_semi_ignoredf>n;42 and f>n;42; both return 42
  • fn_body_multi_stmt_trailing_semi_ignored — multi-statement body with trailing ; unchanged
  • lambda_body_trailing_semi_ignored(x:n>n;+x 1;) works in a map call
  • match_arm_trailing_semi_ignored?x{1:10;_:20;} parses identically to without trailing ;
  • double_semi_at_body_start_is_errorf>n;;42 fails with a parse error

Closes ILO-405.

🤖 Generated with Claude Code

Add a dedicated "Trailing-semicolon semantics" section to SPEC.md
documenting when a trailing `;` is required, allowed, or silently
consumed across all three body contexts (function bodies, inline-lambda
bodies, match-arm bodies). Add five regression tests pinning the
behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@danieljohnmorris danieljohnmorris added the mini Created by mini PC autonomous workflow label May 22, 2026
@danieljohnmorris danieljohnmorris merged commit a74b89a into main May 22, 2026
5 of 6 checks passed
@danieljohnmorris danieljohnmorris deleted the docs/trailing-semi-spec branch May 22, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mini Created by mini PC autonomous workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant