consider proc return type as weak reference in codegen (#24894)

fixes #7706

(cherry picked from commit 9c2593444a)
This commit is contained in:
metagn
2025-04-21 09:58:45 +03:00
committed by narimiran
parent cfe89097e7
commit beb54a5a75
2 changed files with 16 additions and 1 deletions

View File

@@ -597,7 +597,7 @@ proc genProcParams(m: BModule; t: PType, rettype, params: var Rope,
if t.returnType == nil or isInvalidReturnType(m.config, t):
rettype = "void"
else:
rettype = getTypeDescAux(m, t.returnType, check, dkResult)
rettype = getTypeDescWeak(m, t.returnType, check, dkResult)
for i in 1..<t.n.len:
if t.n[i].kind != nkSym: internalError(m.config, t.n.info, "genProcParams")
var param = t.n[i].sym

View File

@@ -0,0 +1,15 @@
# issue #7706
type
Op = enum
Halt
Inc
Dec
type
InstrNext = proc (val: var int, code: seq[Op], pc: var int, stop: var bool): OpH {.inline, nimcall.}
OpH = object
handler: InstrNext
var a: OpH