From 4ccf3fc02f6a1b1bcadda2cf251bf1645d6a9135 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:51:18 +0800 Subject: [PATCH] progress --- compiler/transf.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/transf.nim b/compiler/transf.nim index 3fae44b391..47be5b9c61 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -725,7 +725,9 @@ proc putArgInto(arg: PNode, formal: PType; borrowedFirstArg = false): TPutArgInt else: if skipTypes(formal, abstractInst).kind in {tyVar, tyLent}: result = paVarAsgn else: result = paFastAsgn - if borrowedFirstArg and result == paDirectMapping and parampatterns.exprRoot(arg) == nil: + + if borrowedFirstArg and result == paDirectMapping and parampatterns.exprRoot(arg) == nil and + parampatterns.isAssignable(nil, arg) == arNone: # Inline iterators like `items(array)` borrow from the first argument. # If that argument is just a transient expression, materialize it so the # lifted closure keeps the backing storage alive across yields.