fix genericsOpenSym switch semantics by adding another node flag #23572
+68
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 asnfDisabledOpenSym
, 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.