From 675c629feea96da67267c2ca3c2ecdf528f48537 Mon Sep 17 00:00:00 2001 From: Miran Date: Thu, 18 Oct 2018 12:29:32 +0200 Subject: [PATCH] replace deprecated `safeAdd` with `add` (#9416) --- compiler/rodimpl.nim | 6 +++--- compiler/semcall.nim | 2 +- compiler/seminst.nim | 2 +- compiler/semstmts.nim | 2 +- compiler/semtypinst.nim | 2 +- compiler/sigmatch.nim | 8 ++++---- compiler/types.nim | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/rodimpl.nim b/compiler/rodimpl.nim index 420c5bf7fa..eab305d5ca 100644 --- a/compiler/rodimpl.nim +++ b/compiler/rodimpl.nim @@ -616,7 +616,7 @@ proc loadType(g; id: int; info: TLineInfo): PType = doAssert b.s[b.pos] == '\20' inc(b.pos) let y = loadSym(g, decodeVInt(b.s, b.pos), info) - result.methods.safeAdd((x, y)) + result.methods.add((x, y)) decodeLoc(g, b, result.loc, info) while b.s[b.pos] == '^': inc(b.pos) @@ -656,7 +656,7 @@ proc decodeInstantiations(g; b; info: TLineInfo; if b.s[b.pos] == '\20': inc(b.pos) ii.compilesId = decodeVInt(b.s, b.pos) - s.safeAdd ii + s.add ii proc loadSymFromBlob(g; b; info: TLineInfo): PSym = if b.s[b.pos] == '{': @@ -717,7 +717,7 @@ proc loadSymFromBlob(g; b; info: TLineInfo): PSym = of skType, skGenericParam: while b.s[b.pos] == '\14': inc(b.pos) - result.typeInstCache.safeAdd loadType(g, decodeVInt(b.s, b.pos), result.info) + result.typeInstCache.add loadType(g, decodeVInt(b.s, b.pos), result.info) of routineKinds: decodeInstantiations(g, b, result.info, result.procInstCache) if b.s[b.pos] == '\16': diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 61d6113dc1..49b3442747 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -105,7 +105,7 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode, if cmp < 0: best = z # x is better than the best so far elif cmp == 0: alt = z # x is as good as the best so far elif errorsEnabled or z.diagnosticsEnabled: - errors.safeAdd(CandidateError( + errors.add(CandidateError( sym: sym, unmatchedVarParam: int z.mutabilityProblem, firstMismatch: z.firstMismatch, diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 833edacac4..b6936d1beb 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -377,7 +377,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, #if c.compilesContextId == 0: rawHandleSelf(c, result) entry.compilesId = c.compilesContextId - fn.procInstCache.safeAdd(entry) + fn.procInstCache.add(entry) c.generics.add(makeInstPair(fn, entry)) if n.sons[pragmasPos].kind != nkEmpty: pragma(c, result, n.sons[pragmasPos], allRoutinePragmas) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index d2b8663669..0ace01bc5b 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1517,7 +1517,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) = tyAlias, tySink}) if x.kind == tyObject and t.len-1 == n.sons[genericParamsPos].len: foundObj = true - x.methods.safeAdd((col,s)) + x.methods.add((col,s)) if not foundObj: message(c.config, n.info, warnDeprecated, "generic method not attachable to object type") else: diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index bf06b019f9..b05fb37ae4 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -69,7 +69,7 @@ proc cacheTypeInst*(inst: PType) = let t = if gt.kind == tyGenericBody: gt.lastSon else: gt if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses: return - gt.sym.typeInstCache.safeAdd(inst) + gt.sym.typeInstCache.add(inst) type diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 2fc98c69b6..4fd4a3205e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -728,7 +728,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType = else: makeTypeDesc(c, typ) - typeParams.safeAdd((param, typ)) + typeParams.add((param, typ)) addDecl(c, param) @@ -757,7 +757,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType = if collectDiagnostics: m.c.config.writelnHook = oldWriteHook for msg in diagnostics: - m.diagnostics.safeAdd msg + m.diagnostics.add msg m.diagnosticsEnabled = true if checkedBody == nil: return nil @@ -1027,7 +1027,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, result = typeRel(c, aOrig.base, candidate) if result != isNone: - c.inferredTypes.safeAdd aOrig + c.inferredTypes.add aOrig aOrig.sons.add candidate result = isEqual return @@ -1727,7 +1727,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, else: result = typeRel(c, f.base, a) if result != isNone: - c.inferredTypes.safeAdd f + c.inferredTypes.add f f.sons.add a of tyTypeDesc: diff --git a/compiler/types.nim b/compiler/types.nim index 6f7d08d38d..485d3c3695 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -406,7 +406,7 @@ const const preferToResolveSymbols = {preferName, preferTypeName, preferModuleInfo, preferGenericArg} template bindConcreteTypeToUserTypeClass*(tc, concrete: PType) = - tc.sons.safeAdd concrete + tc.sons.add concrete tc.flags.incl tfResolved # TODO: It would be a good idea to kill the special state of a resolved