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

gensym anonymous proc symbols #24422

Merged
merged 1 commit into from
Nov 9, 2024
Merged

gensym anonymous proc symbols #24422

merged 1 commit into from
Nov 9, 2024

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Nov 9, 2024

fixes #14067, fixes #15004, fixes #19019

Anonymous procs are added to scope with the name :anonymous. This means that if they have the same signature in a scope, they can consider each other as redefinitions. To prevent this, mark their symbols as sfGenSym so they do not get added to scope or cause any name conflicts. The commented out and not isAnon check wouldn't work because isAnon would not be true if the proc is being resemmed, in which case the name field in the proc AST would have the symbol of the anonymous proc rather than being empty.

There is a separate problem of default values in generic/normal procs not opening new scopes which is partially responsible for #19019.

@Araq Araq merged commit 3e47725 into nim-lang:devel Nov 9, 2024
18 checks passed
Copy link
Contributor

github-actions bot commented Nov 9, 2024

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 3e47725

Hint: mm: orc; opt: speed; options: -d:release
177289 lines; 9.527s; 652.941MiB peakmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants