mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-04 14:38:38 +00:00
fixes #26045; fixes #26046 The fix isolates compiler option state while semantically checking each when nimvm branch. compiler/semexprs.nim:2745 snapshots the option stack, compiler options, diagnostics settings, and enabled features. It analyzes one branch and restores that state in finally. Both the nimvm and else branches use this function. This prevents: ```nim when nimvm: {.push overflowChecks: off.} ``` from disabling overflow checks in following runtime code. It also means a {.pop.} in the opposite branch correctly reports that it has no corresponding {.push.}.