Skip to content

Commit

Permalink
fixes #23019; Regression from 2.0 to devel with raise an unlisted exc… (
Browse files Browse the repository at this point in the history
#23034)

…eption: Exception

fixes #23019

I suppose `implicitPragmas` is called somewhere which converts
`otherPragmas`.

(cherry picked from commit d20b4d5)
  • Loading branch information
ringabout authored and narimiran committed Apr 26, 2024
1 parent eb3aa70 commit 47e4478
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/pragmas.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,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 and sfFromGeneric notin sym.flags: # see issue #12985
if not o.isNil and sfFromGeneric notin sym.flags: # bug #23019
pushInfoContext(c.config, info)
var i = 0
while i < o.len:
Expand Down
23 changes: 23 additions & 0 deletions tests/pragmas/tpush.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,26 @@ proc main(): void =
{.push staticBoundChecks: on.}

main()


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.}

0 comments on commit 47e4478

Please sign in to comment.