mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 04:02:41 +00:00
refs #24766
Detect when we track a call to a forward declaration without explicit
`raises` effects, then when the `raises` check fails for the proc, give
a hint that this forward declaration was tracked as potentially raising
any exception.
(cherry picked from commit 82891e6850)
18 lines
453 B
Nim
18 lines
453 B
Nim
discard """
|
|
action: reject
|
|
nimout: '''
|
|
tforwardraises.nim(15, 14) Hint: n is a forward declaration without explicit .raises, assuming it can raise anything [UnknownRaises]
|
|
tforwardraises.nim(14, 26) template/generic instantiation from here
|
|
tforwardraises.nim(15, 14) Error: n(0) can raise an unlisted exception: Exception
|
|
'''
|
|
"""
|
|
|
|
# issue #24766
|
|
|
|
proc n(_: int)
|
|
|
|
proc s(_: int) {.raises: [CatchableError].} =
|
|
if false: n(0)
|
|
|
|
proc n(_: int) = s(0)
|