Skip to content

Type-check Yul assignment arity against builtin return count#425

Merged
rodrigogribeiro merged 1 commit into
argotorg:mainfrom
axic:yul-assignment
Jun 2, 2026
Merged

Type-check Yul assignment arity against builtin return count#425
rodrigogribeiro merged 1 commit into
argotorg:mainfrom
axic:yul-assignment

Conversation

@axic

@axic axic commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Yul builtins/opcodes either return a single value or none at all (when typed as unit). The Yul type checker previously accepted let x := mstore(1, 1) and similar assignments even though mstore does not produce a value. Compare the number of names on the left-hand side of YAssign/YLet with the actual arity of the right-hand side and report a type error on mismatch.

Fixes #383.

Disclaimer: Mostly created by Claude.

Yul builtins/opcodes either return a single value or none at all
(when typed as `unit`). The Yul type checker previously accepted
`let x := mstore(1, 1)` and similar assignments even though
`mstore` does not produce a value. Compare the number of names on
the left-hand side of `YAssign`/`YLet` with the actual arity of
the right-hand side and report a type error on mismatch.

@rodrigogribeiro rodrigogribeiro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Great work!

@axic

axic commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Great work!

Claude is pretty good! 😅

@rodrigogribeiro rodrigogribeiro merged commit fed886d into argotorg:main Jun 2, 2026
4 checks passed
@axic axic deleted the yul-assignment branch June 2, 2026 09:20
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.

Return stack count is ignored in assembly

3 participants