Skip to content

Fix recv arm fields that destructure - #1970

Merged
sbillig merged 2 commits into
argotorg:masterfrom
sbillig:fix/recv-field-patterns
Nov 10, 2026
Merged

sbillig merged 2 commits into
argotorg:masterfrom
sbillig:fix/recv-field-patterns

Conversation

@sbillig

@sbillig sbillig commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

A recv arm receives a field only when the field's pattern is a plain name, so a destructuring field pattern left its bindings without a value:

recv M {
    Tup { t: (x, y) } -> u256 { x * 10 + y }  // error[16-0004]: normalized body is missing a value
}

Recv arm lowering now binds such a field by a synthetic %t and begins the arm's body with let (x, y) = %t, as a destructured parameter's body does, so the runtime boundary only sees plain names.

  • Diagnostics stay as they were: a refutable field pattern reports 8-0153 (now at the field rather than the whole arm), a name another field binds 8-0032, and an effect's name 8-0134.
  • References and rename search recv arm bodies too, since a field's bindings now live in the body, and skip the synthetic %t binding.

This also unblocks | bindings in recv fields for #1969.

A recv arm receives a field only when the field's pattern is a plain
name, so `V { t: (x, _) } -> u256 { x }` failed with internal error
16-0004: `x` had no value.

Lowering now binds such a field as `%t` and begins the arm's body with
`let (x, _) = %t`, as a destructured parameter's body does. A refutable
field pattern still reports 8-0153, now at the field, and a name that
another field or an effect binds is still reported. References and
rename search recv arm bodies too, since a field's bindings now lie in
the body.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T00:33:22.923260Z 4b14085 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sbillig
sbillig merged commit ca9f576 into argotorg:master Nov 10, 2026
10 checks passed
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