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

ignore modules when looking up symbol with expected type #23597

Merged
merged 1 commit into from May 14, 2024

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented May 11, 2024

fixes #23596

When importing a module and declaring an overloadable symbol with the same name as the module in the same scope, the module symbol can take over and make the declared overload impossible to access. Previously enum overloading had a quirk that bypassed this in a context where a specific enum type was expected but this was removed in #23588. Now this is bypassed in every place where a specific type is expected since module symbols don't have a type and so wouldn't be compatible anyway.

But the issue still exists in places where no type is expected like let x = modulename. I don't see a way of fixing this without nerfing module symbols to the point where they're not accessible by default, which might break some macro code.

@metagn metagn marked this pull request as ready for review May 12, 2024 02:47
@Araq Araq merged commit 81a937c into nim-lang:devel May 14, 2024
19 checks passed
Copy link
Contributor

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

Hint: mm: orc; opt: speed; options: -d:release
178560 lines; 8.182s; 753.059MiB 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
Development

Successfully merging this pull request may close these issues.

Enum Overloading Regression?
2 participants