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

fix genericsOpenSym switch semantics by adding another node flag #23572

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented May 4, 2024

fixes #23386, fixes #23385

The genericsOpenSym experimental switch previously needed to be enabled at the instantiation context of generic procs, and not at their declaration context, so that we can still mark the symbol as open, then give a warning when a symbol would be changed but can't because the switch isn't enabled. This is not good because the warning is given inside the generic proc and the instantiation context can widely vary to the point where only globally enabling the flag would be practical.

Now when genericsOpenSym isn't enabled while a generic proc is resolving symbols, we still mark it normally but also mark it as nfDisabledOpenSym, which stops the symbol from being changed at the last second so we can give a warning instead. This is a lazy way to do this but 1. it's temporary until the switch is made default and 2. we should have working semantics first and can figure out a better way later since it's just an implementation detail.

We also define nimHasGenericsOpenSym now that the semantics of the switch are fixed.

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.

genericsOpenSym not respecting injections across modules Add compile-time symbol for genericsOpenSym
1 participant