0032. Brace delimiters retain newlines inside parentheses
- Status: Accepted
- Date: 2026-10-30
- Plan: M4.4, M4.5 (CP-4.2 review fixes)
- Review: Language semantics; Authoring, tooling and context
Context
The CP-4.2 review found that a global parenthesis counter erases statement and match-arm separators in call arguments. E0514's suggestion to put arms on separate lines cannot repair these programs. The owner requests a delimiter stack and unchanged existing goldens.
Decision
Track opening delimiters in the lexer; ignore newlines only
when the innermost delimiter is ( or [.
Braces restore newlines, including inside call arguments; nested
parentheses suppress them again. Brackets remain unsupported
syntax.
This supersedes the blanket newline-suppression assumption in
ADR-0018
and ADR-0028
only. Their canonical output remains unchanged: retain existing
parenthesized semicolon separators and match-arm commas even where
now optional. This owner-requested extension deviates from the M4
plan's comma-required input rule because the old lexer also broke
multiline if and nested block bodies.
Alternatives considered
- Require commas/semicolons in all parenthesized bodies — makes newline syntax context-sensitive and leaves the misleading E0514 repair unfixed.
- Drop optional separators from formatter output — needlessly changes pre-existing goldens; accepting multiline input does not require a new style.
Consequences
Semicolon-free multiline bodies work in both backends. An exact raw-source CLI regression checks execution and formatting idempotence; a program golden adds differential coverage. Existing syntax, output, diagnostics and traps stay stable.