make usage of foo is a user-defined error
more informative
#13833
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.
/cc @Araq
before PR
procs marked with {.error.} give very uninformative/cryptic errors when used.
Example:
t10464.nim(11, 8) Error: usage of 'isNil' is a user-defined error
totally cryptic, and we have no way to tell where this error comes from, especially in more complex cases where the type of
a
is generic, and there are many overloads.after PR
we show where the symbol is defined, eg:
t10464.nim(11, 8) Error: usage of 'isNil' is an {.error.} defined at /Users/timothee/git_clone/nim/Nim_prs/lib/system.nim(1509, 1)
now it's clear: looking up the definition there shows:
(and looking up {.nilError.} shows this resolves to {.error.})