Skip to content

Parser: a receiver written untyped beside the method keyword is the keyword's receiver (#897) - #2718

Merged
ehartford merged 1 commit into
fix-899from
fix-897
Oct 26, 2026
Merged

ehartford merged 1 commit into
fix-899from
fix-897

Conversation

@ehartford

@ehartford ehartford commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

parse_param_list's D7 path synthesizes self from the method keyword
unless the method writes its own self, which it took for the transition
form mut self: Self and parsed as an ordinary parameter. Written
untyped (mut fn take_it(mut self)) that parameter had no type: MIR
assigned the field move to it and the validator refused "use rvalue type
is incompatible with assign destination" in take_it; a plain
fn read_n(self) was "method receiver mode is missing". A written
receiver with no : Type is now consumed and the keyword's receiver is
synthesized; one whose mode is not the keyword's (mut fn f(move self))
is refused, since the keyword decides the receiver.

Tests: test/behavior/behav_897_written_receiver_is_the_keywords.w,
test/compile_errors/err_897_written_receiver_mode_conflict.w.

Closes #897

…eyword's receiver (#897)

parse_param_list's D7 path synthesizes `self` from the method keyword
unless the method writes its own `self`, which it took for the transition
form `mut self: Self` and parsed as an ordinary parameter. Written
untyped (`mut fn take_it(mut self)`) that parameter had no type: MIR
assigned the field move to it and the validator refused "use rvalue type
is incompatible with assign destination" in `take_it`; a plain
`fn read_n(self)` was "method receiver mode is missing". A written
receiver with no `: Type` is now consumed and the keyword's receiver is
synthesized; one whose mode is not the keyword's (`mut fn f(move self)`)
is refused, since the keyword decides the receiver.

Tests: test/behavior/behav_897_written_receiver_is_the_keywords.w,
test/compile_errors/err_897_written_receiver_mode_conflict.w.
@ehartford
ehartford added this pull request to stack #2721 October 26, 2026 00:47
@ehartford ehartford changed the title fix 897 Parser: a receiver written untyped beside the method keyword is the keyword's receiver (#897) Oct 26, 2026
@ehartford
ehartford marked this pull request as ready for review October 26, 2026 01:49
@ehartford
ehartford merged commit d8cd406 into main Oct 26, 2026
@ehartford
ehartford deleted the fix-897 branch October 26, 2026 01:50
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.

Bare '(mut self)' receiver param passes check but collapses in lowering (codegen failure / bogus generic-contract BUG)

1 participant