From 4728c52c787b19c60a5533e20b7d71ee9ca137a3 Mon Sep 17 00:00:00 2001 From: Bung Date: Tue, 25 Oct 2022 14:43:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#12094=20Use=20of=20=5F=20(as=20var=20pla?= =?UTF-8?q?ceholder)=20inside=20a=20template=20causes=20XDe=E2=80=A6=20(#2?= =?UTF-8?q?0635)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #12094 Use of _ (as var placeholder) inside a template causes XDeclaredButNotUsed --- compiler/semstmts.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 596995adb5..81be677252 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -370,7 +370,8 @@ proc addToVarSection(c: PContext; result: var PNode; orig, identDefs: PNode) = result.add identDefs proc isDiscardUnderscore(v: PSym): bool = - if v.name.s == "_": + # template generated underscore symbol name starts with _`gensym + if v.name.s == "_" or v.name.s.startsWith("_`"): v.flags.incl(sfGenSym) result = true