From 47e447862cdbfd56b8826116c92ca4691627f903 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Wed, 6 Dec 2023 04:04:41 +0800 Subject: [PATCH] =?UTF-8?q?fixes=20#23019;=20Regression=20from=202.0=20to?= =?UTF-8?q?=20devel=20with=20raise=20an=20unlisted=20exc=E2=80=A6=20(#2303?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …eption: Exception fixes #23019 I suppose `implicitPragmas` is called somewhere which converts `otherPragmas`. (cherry picked from commit d20b4d5168780b9c6a3bd2fde28b171cb7414c98) --- compiler/pragmas.nim | 2 +- tests/pragmas/tpush.nim | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 8e11ade4ed0e4..2f485ac901599 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -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: diff --git a/tests/pragmas/tpush.nim b/tests/pragmas/tpush.nim index 6d7eade91fc4a..8fd8adc81ba87 100644 --- a/tests/pragmas/tpush.nim +++ b/tests/pragmas/tpush.nim @@ -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.}