From e20feb62efe7db1744edc96c4e20ecf836317222 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 30 Apr 2026 21:20:58 +0800 Subject: [PATCH 1/2] fixes lent tuple codegen error --- compiler/semexprs.nim | 15 +++++++++++---- tests/lent/tlent_tuple_address.nim | 12 ++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 tests/lent/tlent_tuple_address.nim diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 64a8d2a4f9e13..05edb45e85fca 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -652,6 +652,9 @@ proc overloadedCallOpr(c: PContext, n: PNode): PNode = result = semExpr(c, result, flags = {efNoUndeclared}) proc changeType(c: PContext; n: PNode, newType: PType, check: bool) = + template isViewTarget(t: PType): bool = + t.skipTypes({tyGenericInst, tyAlias, tySink}).kind in {tyVar, tyLent} + case n.kind of nkCurly: for i in 0.. Date: Thu, 30 Apr 2026 21:22:58 +0800 Subject: [PATCH 2/2] fixes --- compiler/semexprs.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 05edb45e85fca..aa0489cd225f1 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -715,7 +715,7 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) = "' to '" & typeNameAndDesc(newType) & "'") else: discard - n.typ = newType # `n` is either the wrongNode in an error or same as `result` + n.typ = newType proc arrayConstrType(c: PContext, n: PNode): PType = var typ = newTypeS(tyArray, c)