Skip to content

Spec: a match arm is pattern [if guard] => body, in the three body forms (#2744, D163) - #2750

Merged
ehartford merged 1 commit into
mainfrom
fix-2744
Oct 27, 2026
Merged

ehartford merged 1 commit into
mainfrom
fix-2744

Conversation

@ehartford

@ehartford ehartford commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Spec: a match arm is pattern [if guard] => body, in the three body forms (#2744, D163)

The compiler has always required => after an arm's pattern and taken
the body inline, indented, or braced, but the spec showed that only by
example — and two sentences said the opposite: §29.13 required : or
{ after every construct's header, and §30.8 listed match arms among
those constructs, so a literal reader writes Some(x): and gets
"expected '=>'". §30.4 allowed only an expression after =>.

§9.7 now states the arm rule; §29.13 excepts match arms from the
:/{ introducer rule (their introducer is =>); §30.4 takes an
ARM_BODY (expression, indented block, or braced block); §30.8 drops
match arms from the colon constructs. No compiler behavior changes.

Evidence on main dee141b with with v0.15.3.0: all three arm body
forms run (1/2/3), and Some(v): is refused with "expected '=>'" —
pinned by behav_2744_match_arm_three_body_forms and
err_2744_match_arm_colon_body (both pass pre-change; they pin the
behavior the words now state). :spec-inventory-check green.

Delegated under D98 as D163 (90%: the rule content is the confirmed
compiler behavior from #2744; not C interop, ownership or safety; a
revert is one commit). Eric vetoes by revert or rewords.

…forms (#2744, D163)

The compiler has always required `=>` after an arm's pattern and taken
the body inline, indented, or braced, but the spec showed that only by
example — and two sentences said the opposite: §29.13 required `:` or
`{` after every construct's header, and §30.8 listed match arms among
those constructs, so a literal reader writes `Some(x):` and gets
"expected '=>'". §30.4 allowed only an expression after `=>`.

§9.7 now states the arm rule; §29.13 excepts match arms from the
`:`/`{` introducer rule (their introducer is `=>`); §30.4 takes an
`ARM_BODY` (expression, indented block, or braced block); §30.8 drops
match arms from the colon constructs. No compiler behavior changes.

Evidence on main dee141b with `with v0.15.3.0`: all three arm body
forms run (1/2/3), and `Some(v):` is refused with "expected '=>'" —
pinned by behav_2744_match_arm_three_body_forms and
err_2744_match_arm_colon_body (both pass pre-change; they pin the
behavior the words now state). :spec-inventory-check green.

Delegated under D98 as D163 (90%: the rule content is the confirmed
compiler behavior from #2744; not C interop, ownership or safety; a
revert is one commit). Eric vetoes by revert or rewords.
@ehartford
ehartford added this pull request to stack #2754 October 27, 2026 01:51
@ehartford ehartford changed the title fix 2744 Spec: a match arm is pattern [if guard] => body, in the three body forms (#2744, D163) Oct 27, 2026
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack top 3e1594f7d (stack #2754: #2750 #2751 #2752 #2753): tools/battery.w rc=0, wall 440s — gate, UAT and battery-checks all green (behavior-tests 1957 files ok; uat 12 pass, 1 skip; every survey "all targets green"). Each layer also passed src/main build :gate on its own commit before the stack battery (fix-2744, fix-981, fix-959b, fix-2530-diag, all rc=0 under the pinned seed). Merging the stack.

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