From 3a42572b19e8155b4fdb821437f782e31356d70c Mon Sep 17 00:00:00 2001 From: Tomohiro Date: Sun, 15 Mar 2026 15:57:16 +0900 Subject: [PATCH] fixes compiling `newSeq` call with `nim ic` generates compile error (#25603) Compiling following code with `nim ic test.nim` or `nim m test.nim` generated compile errors. ```nim var s: seq[int] newSeq(s, 1) ``` This PR fixes above bug. This bug was caused by wrong PType/PSym tree generated by `ast2nif.loadSym` proc because generic param symbols in NIF files have all `0`. `TSym.instantiatedFromImpl` is not related to the bug but it seems all field of `TSym` should be copied in `transitionSymKindCommon` template. --- compiler/ast.nim | 3 ++- compiler/astdef.nim | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 5b08ea5e60..8a095311ed 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1270,7 +1270,8 @@ template transitionSymKindCommon*(k: TSymKind) = s[] = TSym(kindImpl: k, itemId: obj.itemId, magicImpl: obj.magicImpl, typImpl: obj.typImpl, name: obj.name, infoImpl: obj.infoImpl, ownerFieldImpl: obj.ownerFieldImpl, flagsImpl: obj.flagsImpl, astImpl: obj.astImpl, optionsImpl: obj.optionsImpl, positionImpl: obj.positionImpl, offsetImpl: obj.offsetImpl, - locImpl: obj.locImpl, annexImpl: obj.annexImpl, constraintImpl: obj.constraintImpl) + disamb: obj.disamb, locImpl: obj.locImpl, annexImpl: obj.annexImpl, constraintImpl: obj.constraintImpl, + instantiatedFromImpl: obj.instantiatedFromImpl) when hasFFI: s.cnameImpl = obj.cnameImpl when defined(nimsuggest): diff --git a/compiler/astdef.nim b/compiler/astdef.nim index 242cdf3ef6..6a7b4d7788 100644 --- a/compiler/astdef.nim +++ b/compiler/astdef.nim @@ -701,6 +701,7 @@ type PLib* = ref TLib TSym* {.acyclic.} = object # Keep in sync with ast2nif.nim + # Check `transitionSymKindCommon` in ast.nim when add a new field. itemId*: ItemId # proc and type instantiations are cached in the generic symbol state*: ItemState