Open timotheecour opened 4 years ago
when defined case2: # D20200419T033153
var a = 10
var b: uint = 12
for i in a..b:
echo $($type(i), i)
=> looks like some weird transfo was applied, and no clear reference to
template dotdotImpl(t) {.dirty.} =
iterator `..`*(a, b: t): t {.inline.} =
t10581.nim(37, 13) Error: type mismatch: got <HSlice[system.int, system.uint]>
but expected one of:
iterator items(E: typedesc[enum]): E:type
first type mismatch at position: 1
required type for E: type enum
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items(a: cstring): char
first type mismatch at position: 1
required type for a: cstring
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items(a: string): char
first type mismatch at position: 1
required type for a: string
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items[IX, T](a: array[IX, T]): T
first type mismatch at position: 1
required type for a: array[IX, T]
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items[T](a: openArray[T]): T
first type mismatch at position: 1
required type for a: openArray[T]
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items[T](a: seq[T]): T
first type mismatch at position: 1
required type for a: seq[T]
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items[T](a: set[T]): T
first type mismatch at position: 1
required type for a: set[T]
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
iterator items[T](s: HSlice[T, T]): T
first type mismatch at position: 1
required type for s: HSlice[items.T, items.T]
but expression 'a .. b' is of type: HSlice[system.int, system.uint]
expression: items(a .. b)
for i in a..b:
-[ ] and has to be used (or discarded); start of expression here:
points to wrong location
D20200506T223706
nim r $timn_D/tests/nim/all/t10700.nim /Users/timothee/git_clone/nim/timn/tests/nim/all/t10700.nim(9, 1) template/generic instantiation from here /Users/timothee/git_clone/nim/timn/tests/nim/all/t10700.nim(12, 6) Error: expression 'ret2`gensym36362015' is of type 'int' and has to be used (or discarded); start of expression here: /Users/timothee/git_clone/nim/timn/tests/nim/all/t10700.nim(10, 3) to2("12", int) ^
template to2*[S](a: S, T: typed): untyped =
var ret2: T
ret2
proc main()=
var ret: int
ret = 1
to2("12", int)
main()
refs https://github.com/nim-lang/Nim/issues/16001#issuecomment-730118098 refs TITLE: nim check (or --errormax:N) reports redundant errors · Issue #16178 · nim-lang/Nim
I've just read the elm blog and I'm very impressed - clear and explicit. The json output they have could be really useful for IDEs as well.
[ ] https://github.com/nim-lang/Nim/pull/16152#issuecomment-742189649
fix the column number in errmsg in https://github.com/nim-lang/Nim/issues/16150#issue-751857489
renderTree
, and instead showing source code or renderTree
before any template expansion / constant foldingrefs: https://github.com/nim-lang/Nim/pull/16152#issuecomment-742189649
type P = distinct pointer
proc fun(a: P): string {.borrow.}
t10570.nim(12, 6) Error: type mismatch: got <pointer>
but expected one of:
proc fun(a: P): string
first type mismatch at position: 1
required type for a: P
but expression '' is of type: pointer
expression: fun()
proc fun(a: P): string {.borrow.}
at very least, ''
and fun()
are wrong
links
[ ] [TODO] [feature] Nim error messages should show line contents, would save lots of debugging time · Issue #7586 · nim-lang/Nim
[ ] [TODO] [error messages]: show col using visible marker instead of newline + caret, saves 2 lines per msg by timotheecour · Pull Request #7636 · nim-lang/Nim
[ ] [TODO] address #7586: make hintsSource print context for all msgs, add by timotheecour · Pull Request #7635 · nim-lang/Nim
[ ] [RFC] type mismatch error message improvement · Issue #87 · nim-lang/RFCs
[ ] More colorful error messages by beef331 · Pull Request #16356 · nim-lang/Nim