Files
Nim/tests/errmsgs/tforwardraises.nim
metagn ee1ecbd51e give hint for forward declarations with unknown raises effects (#24767)
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)
2025-03-13 12:27:44 +01:00

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)