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

wrong context shown for Error: can raise an unlisted exception #10325

Closed
timotheecour opened this issue Jan 16, 2019 · 2 comments
Closed

wrong context shown for Error: can raise an unlisted exception #10325

timotheecour opened this issue Jan 16, 2019 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Jan 16, 2019

git clone https://github.com/nitely/nim-regex
cd nim-regex
git checkout 31f3e283e5e992fe0f05c87fb4a885665b28525e # because I'm fixing it, so need to be before the fix to repro this bug
nimble develop

t0118.nim:

import pkg/regex
nim c -r $timn_D/bugs/all/t0118.nim
nim c --hint:conf:off --nimcache:/tmp/nim//nimcache/ -o:/tmp/nim//app -r /Users/timothee/git_clone//nim//timn//bugs/all/t0118.nim
/Users/timothee/git_clone/nim/timn/bugs/all/t0118.nim(5, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex.nim(2838, 45) template/generic instantiation from here
/Users/timothee/git_clone/nim/Nim/lib/pure/parseutils.nim(285, 54) Error: can raise an unlisted exception: ValueError

this is super confusing since parseutils.nim(285, 54) points to parseInt which does list ValueError

proc parseInt*(s: string, number: var int, start = 0): int {.
  rtl, extern: "npuParseInt", noSideEffect, raises: [ValueError].} =

note:

  try:
    discard parseInt(first, firstNum)
    discard parseInt(last, lastNum)
  except OverflowError:
    prettycheck(
      false,
      "Invalid repetition range. Max value is $#" %% $int16.high)

potential solution

it could simply be as simple as addressing this comment (untested): https://github.com/nim-lang/Nim/pull/10284/files/aab97182d52f71b98499f143c105b9b282243e3e#r247322180

Please turn this into a proc that does the raise and mark the proc with .noinline, produces better code.

@GULPF
Copy link
Member

GULPF commented Jan 16, 2019

This looks like a duplicate of #8482

@GULPF
Copy link
Member

GULPF commented Jan 24, 2019

Closing as duplicate of #8482

@GULPF GULPF closed this as completed Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants