Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make name clash with a builtin non-fatal in Yul parser #15712

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

cameel
Copy link
Member

@cameel cameel commented Jan 14, 2025

Currently Yul parser stops immediately when it notices that a function or variable being declared has a name matching a Yul builtin. I don't see any good reason for this to be a fatal error. In fact the same exact error is already non-fatal in inline assembly. Clashes with reserved identifiers are also non-fatal.

This is a minor thing but, aside from unnecessarily giving users less information than we can, it also makes writing some kinds of tests a bit more annoying (e.g. in #15700 it makes it impossible to have one test covering all Yul builtins).

@cameel cameel requested review from r0qs and clonker January 14, 2025 16:48
@cameel cameel self-assigned this Jan 14, 2025
Comment on lines +2 to +5
let x: jump
x := true: dup12

function f(y: jumpi) {}
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that, in case of type names, the parser does not complain about the name clash with reserved identifiers even though it does for builtins. Does this mean that we were not checking this at all back when types were allowed?

Copy link
Member

@clonker clonker Jan 20, 2025

Choose a reason for hiding this comment

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

I just checked with this example by replacing x by bool, f by bool, and y by bool (and setting all the types to bool as well) on an older compiler version. There is no warning and/or error being raised. At least on 0.8.20, which is the version I randomly picked.

@cameel cameel force-pushed the make-clash-with-yul-builtin-non-fatal branch 2 times, most recently from a3cbe60 to 1a2b1a4 Compare January 14, 2025 21:17
clonker
clonker previously approved these changes Jan 20, 2025
Copy link
Member

@clonker clonker left a comment

Choose a reason for hiding this comment

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

PR looks good to me, we could potentially look into the reserved identifier topic in a follow-up

@cameel cameel force-pushed the make-clash-with-yul-builtin-non-fatal branch from 4e63714 to edb6783 Compare January 22, 2025 13:42
@cameel cameel merged commit 6daaff7 into develop Jan 22, 2025
73 checks passed
@cameel cameel deleted the make-clash-with-yul-builtin-non-fatal branch January 22, 2025 19:10
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