Skip to content
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

misc error msg #104

Open
5 tasks
timotheecour opened this issue Apr 17, 2020 · 9 comments
Open
5 tasks

misc error msg #104

timotheecour opened this issue Apr 17, 2020 · 9 comments
Labels
compiler_messages errors, warnings, hints

Comments

@timotheecour
Copy link
Owner Author

timotheecour commented Apr 19, 2020

  • sigmatch err shd show loc of candidates
    eg: this is hard to grok:
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:

@timotheecour
Copy link
Owner Author

@timotheecour
Copy link
Owner Author

  • hint:processing:on should show include files; also should show more info about modules (eg option for full path; module name, and whether it's include or import; and by what module it came from)

@timotheecour
Copy link
Owner Author

timotheecour commented May 7, 2020

-[ ] 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()

@timotheecour timotheecour added the compiler_messages errors, warnings, hints label May 16, 2020
@timotheecour
Copy link
Owner Author

timotheecour commented Nov 26, 2020

  • report at most 1 error per line would go a long way and is easy to implement

refs nim-lang#16001 (comment)
refs TITLE: nim check (or --errormax:N) reports redundant errors · Issue #16178 · nim-lang/Nim

@timotheecour
Copy link
Owner Author

timotheecour commented Dec 1, 2020

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.

@timotheecour
Copy link
Owner Author

@timotheecour
Copy link
Owner Author

  • option to avoid template expansion when showing errmsgs via renderTree, and instead showing source code or renderTree before any template expansion / constant folding

refs: nim-lang#16152 (comment)

@timotheecour
Copy link
Owner Author

  • borrow gives bad errmsgs D20200417T010112
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler_messages errors, warnings, hints
Projects
None yet
Development

No branches or pull requests

1 participant