[feature] detect unused imports
This commit is contained in:
parent
44d80dd863
commit
4137a4dbf3
12 changed files with 62 additions and 33 deletions
|
|
@ -99,7 +99,7 @@ type
|
|||
const
|
||||
isNilConversion = isConvertible # maybe 'isIntConv' fits better?
|
||||
|
||||
proc markUsed*(conf: ConfigRef; info: TLineInfo, s: PSym; usageSym: var PSym)
|
||||
proc markUsed*(c: PContext; info: TLineInfo, s: PSym; usageSym: var PSym)
|
||||
|
||||
template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone
|
||||
|
||||
|
|
@ -1882,7 +1882,7 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
|
|||
dest = generateTypeInstance(c, m.bindings, arg, dest)
|
||||
let fdest = typeRel(m, f, dest)
|
||||
if fdest in {isEqual, isGeneric} and not (dest.kind == tyLent and f.kind == tyVar):
|
||||
markUsed(c.config, arg.info, c.converters[i], c.graph.usageSym)
|
||||
markUsed(c, arg.info, c.converters[i], c.graph.usageSym)
|
||||
var s = newSymNode(c.converters[i])
|
||||
s.typ = c.converters[i].typ
|
||||
s.info = arg.info
|
||||
|
|
@ -2211,7 +2211,7 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType,
|
|||
else: result = nil
|
||||
else:
|
||||
# only one valid interpretation found:
|
||||
markUsed(m.c.config, arg.info, arg.sons[best].sym, m.c.graph.usageSym)
|
||||
markUsed(m.c, arg.info, arg.sons[best].sym, m.c.graph.usageSym)
|
||||
onUse(arg.info, arg.sons[best].sym)
|
||||
result = paramTypesMatchAux(m, f, arg.sons[best].typ, arg.sons[best],
|
||||
argOrig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue