From 139d2c940fc3520a796da286c3764d6035b4fc0a Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 20 Oct 2025 21:15:01 +0800 Subject: [PATCH] fixes #25008; Compiler internal error compiler/vmgen.nim(1771, 23) with static overload --- compiler/sem.nim | 15 +++++++++++++++ tests/vm/tvmmisc.nim | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/compiler/sem.nim b/compiler/sem.nim index 0739c6e162c7..38da68a0b05c 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -346,6 +346,19 @@ proc fixupTypeAfterEval(c: PContext, evaluated, eOrig: PNode; producedClosure: v isArrayConstr(arg): arg.typ = eOrig.typ +proc resetEvalPosition(n: PNode) = + # resets the eval position of variables because `tryConstExpr` may be + # called multiple times on the same node + case n.kind + of {nkNone..nkNilLit}-{nkSym}: + discard + of nkSym: + if n.sym.kind in {skVar, skLet} and sfGlobal notin n.sym.flags: + n.sym.position = 0 + else: + for i in 0..