[refactoring] compiler: simplified markUsed

This commit is contained in:
Andreas Rumpf 2019-08-08 22:43:58 +02:00
commit 81ddc67785
9 changed files with 50 additions and 50 deletions

View file

@ -295,7 +295,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode =
# constraint not fulfilled: # constraint not fulfilled:
if not ok: return nil if not ok: return nil
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
if ctx.subMatch: if ctx.subMatch:
assert m.len == 3 assert m.len == 3
m.sons[1] = result m.sons[1] = result

View file

@ -450,7 +450,7 @@ proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
pushInfoContext(c.config, nOrig.info, sym.detailedInfo) pushInfoContext(c.config, nOrig.info, sym.detailedInfo)
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, sym, c.graph.usageSym) markUsed(c, info, sym)
onUse(info, sym) onUse(info, sym)
if sym == c.p.owner: if sym == c.p.owner:
globalError(c.config, info, "recursive dependency: '$1'" % sym.name.s) globalError(c.config, info, "recursive dependency: '$1'" % sym.name.s)

View file

@ -475,7 +475,7 @@ proc semResolvedCall(c: PContext, x: TCandidate,
assert x.state == csMatch assert x.state == csMatch
var finalCallee = x.calleeSym var finalCallee = x.calleeSym
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, finalCallee, c.graph.usageSym) markUsed(c, info, finalCallee)
onUse(info, finalCallee) onUse(info, finalCallee)
assert finalCallee.ast != nil assert finalCallee.ast != nil
if x.hasFauxMatch: if x.hasFauxMatch:
@ -585,7 +585,7 @@ proc explicitGenericSym(c: PContext, n: PNode, s: PSym): PNode =
var newInst = generateInstance(c, s, m.bindings, n.info) var newInst = generateInstance(c, s, m.bindings, n.info)
newInst.typ.flags.excl tfUnresolved newInst.typ.flags.excl tfUnresolved
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, s, c.graph.usageSym) markUsed(c, info, s)
onUse(info, s) onUse(info, s)
result = newSymNode(newInst, info) result = newSymNode(newInst, info)

View file

@ -25,7 +25,7 @@ const
proc semTemplateExpr(c: PContext, n: PNode, s: PSym, proc semTemplateExpr(c: PContext, n: PNode, s: PSym,
flags: TExprFlags = {}): PNode = flags: TExprFlags = {}): PNode =
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, s, c.graph.usageSym) markUsed(c, info, s)
onUse(info, s) onUse(info, s)
# Note: This is n.info on purpose. It prevents template from creating an info # Note: This is n.info on purpose. It prevents template from creating an info
# context when called from an another template # context when called from an another template
@ -305,7 +305,7 @@ proc semConv(c: PContext, n: PNode): PNode =
let it = op.sons[i] let it = op.sons[i]
let status = checkConvertible(c, result.typ, it) let status = checkConvertible(c, result.typ, it)
if status in {convOK, convNotNeedeed}: if status in {convOK, convNotNeedeed}:
markUsed(c, n.info, it.sym, c.graph.usageSym) markUsed(c, n.info, it.sym)
onUse(n.info, it.sym) onUse(n.info, it.sym)
markIndirect(c, it.sym) markIndirect(c, it.sym)
return it return it
@ -1106,7 +1106,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
let s = getGenSym(c, sym) let s = getGenSym(c, sym)
case s.kind case s.kind
of skConst: of skConst:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
let typ = skipTypes(s.typ, abstractInst-{tyTypeDesc}) let typ = skipTypes(s.typ, abstractInst-{tyTypeDesc})
case typ.kind case typ.kind
@ -1138,7 +1138,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
of skMacro: of skMacro:
if efNoEvaluateGeneric in flags and s.ast[genericParamsPos].len > 0 or if efNoEvaluateGeneric in flags and s.ast[genericParamsPos].len > 0 or
(n.kind notin nkCallKinds and s.requiredParams > 0): (n.kind notin nkCallKinds and s.requiredParams > 0):
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
result = symChoice(c, n, s, scClosed) result = symChoice(c, n, s, scClosed)
else: else:
@ -1148,13 +1148,13 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
(n.kind notin nkCallKinds and s.requiredParams > 0) or (n.kind notin nkCallKinds and s.requiredParams > 0) or
sfCustomPragma in sym.flags: sfCustomPragma in sym.flags:
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, s, c.graph.usageSym) markUsed(c, info, s)
onUse(info, s) onUse(info, s)
result = symChoice(c, n, s, scClosed) result = symChoice(c, n, s, scClosed)
else: else:
result = semTemplateExpr(c, n, s, flags) result = semTemplateExpr(c, n, s, flags)
of skParam: of skParam:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
if s.typ != nil and s.typ.kind == tyStatic and s.typ.n != nil: if s.typ != nil and s.typ.kind == tyStatic and s.typ.n != nil:
# XXX see the hack in sigmatch.nim ... # XXX see the hack in sigmatch.nim ...
@ -1178,7 +1178,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
if s.magic == mNimvm: if s.magic == mNimvm:
localError(c.config, n.info, "illegal context for 'nimvm' magic") localError(c.config, n.info, "illegal context for 'nimvm' magic")
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
result = newSymNode(s, n.info) result = newSymNode(s, n.info)
# We cannot check for access to outer vars for example because it's still # We cannot check for access to outer vars for example because it's still
@ -1196,7 +1196,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
n.typ = s.typ n.typ = s.typ
return n return n
of skType: of skType:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
if s.typ.kind == tyStatic and s.typ.base.kind != tyNone and s.typ.n != nil: if s.typ.kind == tyStatic and s.typ.base.kind != tyNone and s.typ.n != nil:
return s.typ.n return s.typ.n
@ -1218,7 +1218,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
if f != nil and fieldVisible(c, f): if f != nil and fieldVisible(c, f):
# is the access to a public field or in the same module or in a friend? # is the access to a public field or in the same module or in a friend?
doAssert f == s doAssert f == s
markUsed(c, n.info, f, c.graph.usageSym) markUsed(c, n.info, f)
onUse(n.info, f) onUse(n.info, f)
result = newNodeIT(nkDotExpr, n.info, f.typ) result = newNodeIT(nkDotExpr, n.info, f.typ)
result.add makeDeref(newSymNode(p.selfSym)) result.add makeDeref(newSymNode(p.selfSym))
@ -1231,12 +1231,12 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
if ty.sons[0] == nil: break if ty.sons[0] == nil: break
ty = skipTypes(ty.sons[0], skipPtrs) ty = skipTypes(ty.sons[0], skipPtrs)
# old code, not sure if it's live code: # old code, not sure if it's live code:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
onUse(n.info, s) onUse(n.info, s)
result = newSymNode(s, n.info) result = newSymNode(s, n.info)
else: else:
let info = getCallLineInfo(n) let info = getCallLineInfo(n)
markUsed(c, info, s, c.graph.usageSym) markUsed(c, info, s)
onUse(info, s) onUse(info, s)
result = newSymNode(s, info) result = newSymNode(s, info)
@ -1258,7 +1258,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
result = symChoice(c, n, s, scClosed) result = symChoice(c, n, s, scClosed)
if result.kind == nkSym: result = semSym(c, n, s, flags) if result.kind == nkSym: result = semSym(c, n, s, flags)
else: else:
markUsed(c, n.sons[1].info, s, c.graph.usageSym) markUsed(c, n.sons[1].info, s)
result = semSym(c, n, s, flags) result = semSym(c, n, s, flags)
onUse(n.sons[1].info, s) onUse(n.sons[1].info, s)
return return
@ -1322,7 +1322,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
result = newSymNode(f) result = newSymNode(f)
result.info = n.info result.info = n.info
result.typ = ty result.typ = ty
markUsed(c, n.info, f, c.graph.usageSym) markUsed(c, n.info, f)
onUse(n.info, f) onUse(n.info, f)
return return
of tyObject, tyTuple: of tyObject, tyTuple:
@ -1357,7 +1357,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
else: true else: true
if not visibilityCheckNeeded or fieldVisible(c, f): if not visibilityCheckNeeded or fieldVisible(c, f):
# is the access to a public field or in the same module or in a friend? # is the access to a public field or in the same module or in a friend?
markUsed(c, n.sons[1].info, f, c.graph.usageSym) markUsed(c, n.sons[1].info, f)
onUse(n.sons[1].info, f) onUse(n.sons[1].info, f)
n.sons[0] = makeDeref(n.sons[0]) n.sons[0] = makeDeref(n.sons[0])
n.sons[1] = newSymNode(f) # we now have the correct field n.sons[1] = newSymNode(f) # we now have the correct field
@ -1371,7 +1371,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
elif ty.kind == tyTuple and ty.n != nil: elif ty.kind == tyTuple and ty.n != nil:
f = getSymFromList(ty.n, i) f = getSymFromList(ty.n, i)
if f != nil: if f != nil:
markUsed(c, n.sons[1].info, f, c.graph.usageSym) markUsed(c, n.sons[1].info, f)
onUse(n.sons[1].info, f) onUse(n.sons[1].info, f)
n.sons[0] = makeDeref(n.sons[0]) n.sons[0] = makeDeref(n.sons[0])
n.sons[1] = newSymNode(f) n.sons[1] = newSymNode(f)
@ -1902,7 +1902,7 @@ proc semExpandToAst(c: PContext, n: PNode): PNode =
if expandedSym.kind == skError: return n if expandedSym.kind == skError: return n
macroCall.sons[0] = newSymNode(expandedSym, macroCall.info) macroCall.sons[0] = newSymNode(expandedSym, macroCall.info)
markUsed(c, n.info, expandedSym, c.graph.usageSym) markUsed(c, n.info, expandedSym)
onUse(n.info, expandedSym) onUse(n.info, expandedSym)
if isCallExpr(macroCall): if isCallExpr(macroCall):
@ -1927,7 +1927,7 @@ proc semExpandToAst(c: PContext, n: PNode): PNode =
else: else:
let info = macroCall.sons[0].info let info = macroCall.sons[0].info
macroCall.sons[0] = newSymNode(cand, info) macroCall.sons[0] = newSymNode(cand, info)
markUsed(c, info, cand, c.graph.usageSym) markUsed(c, info, cand)
onUse(info, cand) onUse(info, cand)
# we just perform overloading resolution here: # we just perform overloading resolution here:
@ -2130,42 +2130,42 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result = n result = n
case s.magic # magics that need special treatment case s.magic # magics that need special treatment
of mAddr: of mAddr:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
checkSonsLen(n, 2, c.config) checkSonsLen(n, 2, c.config)
result[0] = newSymNode(s, n[0].info) result[0] = newSymNode(s, n[0].info)
result[1] = semAddrArg(c, n.sons[1], s.name.s == "unsafeAddr") result[1] = semAddrArg(c, n.sons[1], s.name.s == "unsafeAddr")
result.typ = makePtrType(c, result[1].typ) result.typ = makePtrType(c, result[1].typ)
of mTypeOf: of mTypeOf:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semTypeOf(c, n) result = semTypeOf(c, n)
of mDefined: of mDefined:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semDefined(c, setMs(n, s), false) result = semDefined(c, setMs(n, s), false)
of mDefinedInScope: of mDefinedInScope:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semDefined(c, setMs(n, s), true) result = semDefined(c, setMs(n, s), true)
of mCompiles: of mCompiles:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semCompiles(c, setMs(n, s), flags) result = semCompiles(c, setMs(n, s), flags)
of mIs: of mIs:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semIs(c, setMs(n, s), flags) result = semIs(c, setMs(n, s), flags)
of mShallowCopy: of mShallowCopy:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semShallowCopy(c, n, flags) result = semShallowCopy(c, n, flags)
of mExpandToAst: of mExpandToAst:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semExpandToAst(c, n, s, flags) result = semExpandToAst(c, n, s, flags)
of mQuoteAst: of mQuoteAst:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semQuoteAst(c, n) result = semQuoteAst(c, n)
of mAstToStr: of mAstToStr:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
checkSonsLen(n, 2, c.config) checkSonsLen(n, 2, c.config)
result = newStrNodeT(renderTree(n[1], {renderNoComments}), n, c.graph) result = newStrNodeT(renderTree(n[1], {renderNoComments}), n, c.graph)
result.typ = getSysType(c.graph, n.info, tyString) result.typ = getSysType(c.graph, n.info, tyString)
of mParallel: of mParallel:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
if parallel notin c.features: if parallel notin c.features:
localError(c.config, n.info, "use the {.experimental.} pragma to enable 'parallel'") localError(c.config, n.info, "use the {.experimental.} pragma to enable 'parallel'")
result = setMs(n, s) result = setMs(n, s)
@ -2175,7 +2175,7 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result.sons[1] = semStmt(c, x, {}) result.sons[1] = semStmt(c, x, {})
dec c.inParallelStmt dec c.inParallelStmt
of mSpawn: of mSpawn:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
when defined(leanCompiler): when defined(leanCompiler):
localError(c.config, n.info, "compiler was built without 'spawn' support") localError(c.config, n.info, "compiler was built without 'spawn' support")
result = n result = n
@ -2193,12 +2193,12 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
else: else:
result.add c.graph.emptyNode result.add c.graph.emptyNode
of mProcCall: of mProcCall:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = setMs(n, s) result = setMs(n, s)
result.sons[1] = semExpr(c, n.sons[1]) result.sons[1] = semExpr(c, n.sons[1])
result.typ = n[1].typ result.typ = n[1].typ
of mPlugin: of mPlugin:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
# semDirectOp with conditional 'afterCallActions': # semDirectOp with conditional 'afterCallActions':
let nOrig = n.copyTree let nOrig = n.copyTree
#semLazyOpAux(c, n) #semLazyOpAux(c, n)
@ -2215,7 +2215,7 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
if callee.magic != mNone: if callee.magic != mNone:
result = magicsAfterOverloadResolution(c, result, flags) result = magicsAfterOverloadResolution(c, result, flags)
of mRunnableExamples: of mRunnableExamples:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
if c.config.cmd == cmdDoc and n.len >= 2 and n.lastSon.kind == nkStmtList: if c.config.cmd == cmdDoc and n.len >= 2 and n.lastSon.kind == nkStmtList:
when false: when false:
# some of this dead code was moved to `prepareExamples` # some of this dead code was moved to `prepareExamples`
@ -2233,7 +2233,7 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
else: else:
result = c.graph.emptyNode result = c.graph.emptyNode
of mSizeOf: of mSizeOf:
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
result = semSizeof(c, setMs(n, s)) result = semSizeof(c, setMs(n, s))
else: else:
result = semDirectOp(c, n, flags) result = semDirectOp(c, n, flags)
@ -2470,7 +2470,7 @@ proc semExportExcept(c: PContext, n: PNode): PNode =
s.name.id notin exceptSet and sfError notin s.flags: s.name.id notin exceptSet and sfError notin s.flags:
strTableAdd(c.module.tab, s) strTableAdd(c.module.tab, s)
result.add newSymNode(s, n.info) result.add newSymNode(s, n.info)
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
s = nextIter(i, exported.tab) s = nextIter(i, exported.tab)
proc semExport(c: PContext, n: PNode): PNode = proc semExport(c: PContext, n: PNode): PNode =
@ -2491,7 +2491,7 @@ proc semExport(c: PContext, n: PNode): PNode =
strTableAdd(c.module.tab, it) strTableAdd(c.module.tab, it)
result.add newSymNode(it, a.info) result.add newSymNode(it, a.info)
it = nextIter(ti, s.tab) it = nextIter(ti, s.tab)
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
else: else:
while s != nil: while s != nil:
if s.kind == skEnumField: if s.kind == skEnumField:
@ -2500,7 +2500,7 @@ proc semExport(c: PContext, n: PNode): PNode =
if s.kind in ExportableSymKinds+{skModule} and sfError notin s.flags: if s.kind in ExportableSymKinds+{skModule} and sfError notin s.flags:
result.add(newSymNode(s, a.info)) result.add(newSymNode(s, a.info))
strTableAdd(c.module.tab, s) strTableAdd(c.module.tab, s)
markUsed(c, n.info, s, c.graph.usageSym) markUsed(c, n.info, s)
s = nextOverloadIter(o, c, a) s = nextOverloadIter(o, c, a)
proc semTupleConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = proc semTupleConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =

View file

@ -812,7 +812,7 @@ proc handleCaseStmtMacro(c: PContext; n: PNode): PNode =
errors, false) errors, false)
if r.state == csMatch: if r.state == csMatch:
var match = r.calleeSym var match = r.calleeSym
markUsed(c, n[0].info, match, c.graph.usageSym) markUsed(c, n[0].info, match)
onUse(n[0].info, match) onUse(n[0].info, match)
# but pass 'n' to the 'match' macro, not 'n[0]': # but pass 'n' to the 'match' macro, not 'n[0]':

View file

@ -64,7 +64,7 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
# (s.kind notin routineKinds or s.magic != mNone): # (s.kind notin routineKinds or s.magic != mNone):
# for instance 'nextTry' is both in tables.nim and astalgo.nim ... # for instance 'nextTry' is both in tables.nim and astalgo.nim ...
result = newSymNode(s, info) result = newSymNode(s, info)
markUsed(c, info, s, c.graph.usageSym) markUsed(c, info, s)
onUse(info, s) onUse(info, s)
else: else:
# semantic checking requires a type; ``fitNode`` deals with it # semantic checking requires a type; ``fitNode`` deals with it

View file

@ -353,7 +353,7 @@ proc semTypeIdent(c: PContext, n: PNode): PSym =
if result.isNil: if result.isNil:
result = qualifiedLookUp(c, n, {checkAmbiguity, checkUndeclared}) result = qualifiedLookUp(c, n, {checkAmbiguity, checkUndeclared})
if result != nil: if result != nil:
markUsed(c, n.info, result, c.graph.usageSym) markUsed(c, n.info, result)
onUse(n.info, result) onUse(n.info, result)
if result.kind == skParam and result.typ.kind == tyTypeDesc: if result.kind == skParam and result.typ.kind == tyTypeDesc:
@ -1063,7 +1063,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
result = addImplicitGeneric(copyType(paramType, getCurrOwner(c), false)) result = addImplicitGeneric(copyType(paramType, getCurrOwner(c), false))
of tyGenericParam: of tyGenericParam:
markUsed(c, paramType.sym.info, paramType.sym, c.graph.usageSym) markUsed(c, paramType.sym.info, paramType.sym)
onUse(paramType.sym.info, paramType.sym) onUse(paramType.sym.info, paramType.sym)
if tfWildcard in paramType.flags: if tfWildcard in paramType.flags:
paramType.flags.excl tfWildcard paramType.flags.excl tfWildcard
@ -1754,7 +1754,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
else: else:
assignType(prev, t) assignType(prev, t)
result = prev result = prev
markUsed(c, n.info, n.sym, c.graph.usageSym) markUsed(c, n.info, n.sym)
onUse(n.info, n.sym) onUse(n.info, n.sym)
else: else:
if s.kind != skError: if s.kind != skError:

View file

@ -107,7 +107,7 @@ type
const const
isNilConversion = isConvertible # maybe 'isIntConv' fits better? isNilConversion = isConvertible # maybe 'isIntConv' fits better?
proc markUsed*(c: PContext; info: TLineInfo, s: PSym; usageSym: var PSym) proc markUsed*(c: PContext; info: TLineInfo, s: PSym)
template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone
@ -1889,7 +1889,7 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
dest = generateTypeInstance(c, m.bindings, arg, dest) dest = generateTypeInstance(c, m.bindings, arg, dest)
let fdest = typeRel(m, f, dest) let fdest = typeRel(m, f, dest)
if fdest in {isEqual, isGeneric} and not (dest.kind == tyLent and f.kind == tyVar): if fdest in {isEqual, isGeneric} and not (dest.kind == tyLent and f.kind == tyVar):
markUsed(c, arg.info, c.converters[i], c.graph.usageSym) markUsed(c, arg.info, c.converters[i])
var s = newSymNode(c.converters[i]) var s = newSymNode(c.converters[i])
s.typ = c.converters[i].typ s.typ = c.converters[i].typ
s.info = arg.info s.info = arg.info
@ -2218,7 +2218,7 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType,
else: result = nil else: result = nil
else: else:
# only one valid interpretation found: # only one valid interpretation found:
markUsed(m.c, arg.info, arg.sons[best].sym, m.c.graph.usageSym) markUsed(m.c, arg.info, arg.sons[best].sym)
onUse(arg.info, arg.sons[best].sym) onUse(arg.info, arg.sons[best].sym)
result = paramTypesMatchAux(m, f, arg.sons[best].typ, arg.sons[best], result = paramTypesMatchAux(m, f, arg.sons[best].typ, arg.sons[best],
argOrig) argOrig)

View file

@ -542,7 +542,7 @@ proc markOwnerModuleAsUsed(c: PContext; s: PSym) =
else: else:
inc i inc i
proc markUsed(c: PContext; info: TLineInfo; s: PSym; usageSym: var PSym) = proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
let conf = c.config let conf = c.config
incl(s.flags, sfUsed) incl(s.flags, sfUsed)
if s.kind == skEnumField and s.owner != nil: if s.kind == skEnumField and s.owner != nil:
@ -553,7 +553,7 @@ proc markUsed(c: PContext; info: TLineInfo; s: PSym; usageSym: var PSym) =
if sfDeprecated in s.flags: warnAboutDeprecated(conf, info, s) if sfDeprecated in s.flags: warnAboutDeprecated(conf, info, s)
if sfError in s.flags: userError(conf, info, s) if sfError in s.flags: userError(conf, info, s)
when defined(nimsuggest): when defined(nimsuggest):
suggestSym(conf, info, s, usageSym, false) suggestSym(conf, info, s, c.graph.usageSym, false)
if {optStyleHint, optStyleError} * conf.globalOptions != {}: if {optStyleHint, optStyleError} * conf.globalOptions != {}:
styleCheckUse(conf, info, s) styleCheckUse(conf, info, s)
markOwnerModuleAsUsed(c, s) markOwnerModuleAsUsed(c, s)