-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
honor --declaredLocs in more places, including type mismatch errors; also show kind
with --declaredLocs
#15673
honor --declaredLocs in more places, including type mismatch errors; also show kind
with --declaredLocs
#15673
Conversation
ccc062e
to
3226d05
Compare
I think it's a bit too long here. We can certainly borrow a page from C/C++ compilers and print the declaration as a separated hint, which would be much easier to read. |
how about I change:
to
with --declaredLocs:on; and keep the old formatting without newline with --declaredLocs:off this will be consistent with sigmatch error formatting (got on 1 line, candidates on subsequent lines) |
If you spend more time on it, do it properly. The problem is an error message like "expected AbsoluteFile but got AbsoluteFile (= distinct string)" which is caused by different modules that both export AbsoluteFile which is caused by --path issues. So add some logic to make the error message better for "expected X but got X", there is no need for yet another compiler switch that nobody knows about... |
3226d05
to
527c532
Compare
@Araq PTAL
improved formatting, should now read well whether or not declaration locations are shown
done, the declaration locations are now shown when either the names clash or when --declaredlocs is provided example
(all above with --listfullpaths:off) |
…also show `kind` with --declaredLocs (nim-lang#15673) * honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
…also show `kind` with --declaredLocs (nim-lang#15673) * honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
…also show `kind` with --declaredLocs (nim-lang#15673) * honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
followup after #15666
--declaredLocs
in more places, including type mismatch errors, see example 1example 1
before PR:
after PR, when passing
--declaredLocs --listfullpaths:off
:example 2
before PR:
=> cryptic, the error doesn't tell you why Foo doesn't match unless you know that Foo is of kind
object
instead ofref
This is a common problem in my experience.
after PR, when passing
--declaredLocs --listfullpaths:off
:=> now you have all the context to understand the mismatch: fun expects a ref, but Foo is of kind object
future work
cannot instantiate
errors:currently still gives
which has same drawback of lacking sufficient context to understand the error (especially in complicated cases)
=> #17745