-
Notifications
You must be signed in to change notification settings - Fork 10
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
results
valueOr
access to error
template injected symbol fails with certain generic callers
#34
Comments
Upstream discussion: nim-lang/Nim#22605 |
arnetheduck
added a commit
that referenced
this issue
Aug 13, 2024
This PR adds a workaround for the case where a global symbol is matched instead of the local `error`/`value` template in `valueOr` and friends, when `valueOr` is being used in a generic context. Two options are added: * when using Nim version supporting the experimental `genericsOpenSym` [feature](nim-lang/Nim#23873), we use it * when not, a macro tries to replace all accesses in the given body with the correct symbol - this matching is done by name and some minimal heuristics which potentially could be wrong - the upstream solution is obviously preferable Both solutions can be disabled via compile-time options to retain the old behavior of matching the global symbol. See also nim-lang/Nim#22605 thanks to @Araq for the macro hack and @metagn for the language fix!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example, results in an error of:
but if one makes
makeBeaconBlockForHeadAndSlot
non-generic, it compiles fine, even though it doesn't use its dummy parameter regardless.It's the result of conflict between the
error
func
and injected symbol, which is a known Nim issue. Reproduced inin a self-contained way.
Ported from status-im/nim-stew#161
The text was updated successfully, but these errors were encountered: