From fc7fe636e22f1a9a502e805256c01c70e8695f88 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 2 Sep 2019 12:49:31 +0200 Subject: [PATCH] improvement for 'unused import' warnings --- compiler/semtempl.nim | 1 + compiler/sigmatch.nim | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 907d2174e4..acf32d1b32 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -80,6 +80,7 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule; while a != nil: if a.kind != skModule and (not isField or sfGenSym notin s.flags): incl(a.flags, sfUsed) + markOwnerModuleAsUsed(c, a) addSon(result, newSymNode(a, info)) onUse(info, a) a = nextOverloadIter(o, c, n) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 5ddb4c30b8..ea1945a645 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -108,6 +108,7 @@ const isNilConversion = isConvertible # maybe 'isIntConv' fits better? proc markUsed*(c: PContext; info: TLineInfo, s: PSym) +proc markOwnerModuleAsUsed*(c: PContext; s: PSym) template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone