Skip to content

Match fieldless msg variants by path without {} - #1845

Open
sbillig wants to merge 2 commits into
argotorg:masterfrom
sbillig:fix/fieldless-msg-variant-paths
Open

sbillig wants to merge 2 commits into
argotorg:masterfrom
sbillig:fix/fieldless-msg-variant-paths

Conversation

@sbillig

@sbillig sbillig commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

A msg variant declared without fields, like Ping -> u256, could be matched as a bare Ping in a named recv block, but its path M::Ping was rejected with "expected unit variant" and had to be written M::Ping {}. A path pattern naming a fieldless msg variant now matches it like a unit variant, in named and unnamed recv blocks alike. Other records, and msg variants with fields, still need their braces.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T06:42:28.393222Z b398d01 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.

A msg variant declared without fields, like `Ping -> u256`, could be
matched as a bare `Ping` in a named recv block, but its path `M::Ping`
was rejected as "expected unit variant" because the variant lowers to a
record struct, so it needed `M::Ping {}`. A path pattern naming a msg
variant without fields now matches it like a unit variant. Other records
and msg variants with fields still need their braces.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b398d018c8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +466 to +468
&& ty.adt_def(self.db).is_some_and(|adt_def| {
matches!(adt_def.adt_ref(self.db), AdtRef::Struct(struct_)
if implements_msg_variant(self.db, struct_))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve type arguments when checking message variants

When a zero-field variant is generic (for example, a manually supported Empty<u8> with a MsgVariant<Sol> impl), this leaves fieldless_msg_variant false. The resolved ty contains u8, but implements_msg_variant receives only the Struct and reconstructs the unapplied, higher-kinded TyId::adt, which cannot unify with an impl whose self type is Empty<u8> (or Empty<T>). Such variants therefore still emit “expected unit variant” instead of gaining the path-only matching behavior added here; check the actual resolved type rather than discarding its arguments.

Useful? React with 👍 / 👎.

@micahscopes

Copy link
Copy Markdown
Collaborator

from the agents:

With #1846 merged, could the remaining behavior specific to this PR be identified? Both changes cover fieldless message-variant paths in receive arms.

A fixture that still fails on current master would make the remaining change clear. If the intended receive-arm behavior is fully covered by #1846, this PR may now be superseded.

This branch has not been deployed

No deployments
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.

2 participants