You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
nim's revision at latest devel is fbd6743 (to get proper line numbers)
the fix is to s/OverflowError/ValueError/ in regex.nim (see fix error on nim devel nitely/nim-regex#34) but the error should point to parseRepRange declaration (which is the one that can raise an unlisted error, before fixing as below) so please don't close this issue after fix error on nim devel nitely/nim-regex#34 is merged as root cause is still there
try:
discardparseInt(first, firstNum)
discardparseInt(last, lastNum)
exceptOverflowError:
prettycheck(
false,
"Invalid repetition range. Max value is $#"%%$int16.high)
t0118.nim:
this is super confusing since
parseutils.nim(285, 54)
points toparseInt
which does listValueError
note:
nim's revision at latest devel is fbd6743 (to get proper line numbers)
the fix is to s/OverflowError/ValueError/ in regex.nim (see fix error on nim devel nitely/nim-regex#34) but the error should point to
parseRepRange
declaration (which is the one that can raise an unlisted error, before fixing as below) so please don't close this issue after fix error on nim devel nitely/nim-regex#34 is merged as root cause is still thereValueError now inherits from CatchableError #10246Improve exception usage in parseutils #10284, however the root cause for this bug is that context reporting is wrong.potential solution
it could simply be as simple as addressing this comment (untested): https://github.com/nim-lang/Nim/pull/10284/files/aab97182d52f71b98499f143c105b9b282243e3e#r247322180
The text was updated successfully, but these errors were encountered: