fixes #23019; Regression from 2.0 to devel with raise an unlisted exc… (#23034)

…eption: Exception

fixes #23019

I suppose `implicitPragmas` is called somewhere which converts
`otherPragmas`.
This commit is contained in:
ringabout
2023-12-06 04:04:41 +08:00
committed by GitHub
parent 202e21daba
commit d20b4d5168
2 changed files with 23 additions and 1 deletions

View File

@@ -1313,7 +1313,7 @@ proc implicitPragmas*(c: PContext, sym: PSym, info: TLineInfo,
if sym != nil and sym.kind != skModule:
for it in c.optionStack:
let o = it.otherPragmas
if not o.isNil:
if not o.isNil and sfFromGeneric notin sym.flags: # bug #23019
pushInfoContext(c.config, info)
var i = 0
while i < o.len:

View File

@@ -77,3 +77,25 @@ block: # bug #22913
{.pop.}
discard foo2()
block: # bug #23019
proc f(x: bool)
proc a(x: int) =
if false: f(true)
proc f(x: bool) =
if false: a(0)
proc k(r: int|int) {.inline.} = # seems to require being generic and inline
if false: a(0)
# {.push tags: [].}
{.push raises: [].}
{.push warning[ObservableStores]:off.} # can be any warning, off or on
let w = 0
k(w)
{.pop.}
{.pop.}