-
-
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
fix #16150 improve type mismatch errors #16152
Conversation
ef0b7ec
to
7d5d129
Compare
I think this is too verbose, consider if/block/case expressions. We should fix the column number instead. (They don't start at 0, try |
7d5d129
to
0eee6bc
Compare
behavior as implemented in this PR is consistent with sigmatch errors which also show the expression on error, after template expansion, and regardless of how verbose that can become: when true:
proc fn(a: int) = discard
proc bar(a: int): auto = 1.0
var z = 2
template foo(): untyped = bar(1+z)
# fn(foo()) # will show an error that contains: but expression 'bar(1 + z)' is of type: float64
var a: int = foo() # will now show an error containing: got 'float64' for 'bar(1 + z)' but expected 'int'
This is not trivial to do though (related: issues like #7039 and #11789 for const folding or this: #14863 (comment)
There are ways to fix it though.
|
* fix nim-lang#16150 improve type mismatch errors * allow -d:nimLegacyTypeMismatch * address comment
* fix nim-lang#16150 improve type mismatch errors * allow -d:nimLegacyTypeMismatch * address comment
fix #16150
after PR:
with --declaredlocs --listfullpaths:off
use -d:nimLegacyTypeMismatch for previous behavior.
CI failure unrelated: #16169