From ecab26033093e471bd89f7e0db49447d9ead4079 Mon Sep 17 00:00:00 2001 From: metagn Date: Tue, 2 May 2023 12:15:06 +0300 Subject: [PATCH] underscore as special word (#21766) * underscore as special word * fix really hard to notice error (cherry picked from commit ca82b4ea16eb7d48b6851110bcb4667570a97f52) --- compiler/lookups.nim | 6 +++--- compiler/sempass2.nim | 2 +- compiler/semstmts.nim | 2 +- compiler/semtempl.nim | 2 +- compiler/wordrecg.nim | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 1ddeeade26..ca14077726 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -11,7 +11,7 @@ import std/[algorithm, strutils, tables] import intsets, ast, astalgo, idents, semdata, types, msgs, options, - renderer, nimfix/prettybase, lineinfos, modulegraphs, astmsgs + renderer, nimfix/prettybase, lineinfos, modulegraphs, astmsgs, wordrecg proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) @@ -311,10 +311,10 @@ proc wrongRedefinition*(c: PContext; info: TLineInfo, s: string; proc addDeclAt*(c: PContext; scope: PScope, sym: PSym, info: TLineInfo) = let conflict = scope.addUniqueSym(sym) if conflict != nil: - if sym.kind == skModule and conflict.kind == skModule: + if sym.kind == skModule and conflict.kind == skModule: # e.g.: import foo; import foo # xxx we could refine this by issuing a different hint for the case - # where a duplicate import happens inside an include. + # where a duplicate import happens inside an include. if c.importModuleMap[sym.id] == c.importModuleMap[conflict.id]: #only hints if the conflict is the actual module not just a shared name localError(c.config, info, hintDuplicateModuleImport, diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 63bf9ad5f7..92c5598966 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -1076,7 +1076,7 @@ proc track(tracked: PEffects, n: PNode) = elif child.kind == nkVarTuple and last.kind != nkEmpty: for i in 0..