From feb0d21b22bfc678208efd9e84fbe3d33b888f58 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 3 Dec 2016 02:10:55 +0100 Subject: [PATCH] more fixes --- compiler/semexprs.nim | 1 + compiler/sighashes.nim | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 96ba4a8f38..5e6611064b 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1310,6 +1310,7 @@ proc asgnToResultVar(c: PContext, n, le, ri: PNode) {.inline.} = n.sons[0] = x # 'result[]' --> 'result' n.sons[1] = takeImplicitAddr(c, ri) x.typ.flags.incl tfVarIsPtr + #echo x.info, " setting it for this type ", typeToString(x.typ), " ", n.info template resultTypeIsInferrable(typ: PType): untyped = typ.isMetaType and typ.kind != tyTypeDesc diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim index 1774197e95..1eb8d5b9cd 100644 --- a/compiler/sighashes.nim +++ b/compiler/sighashes.nim @@ -147,6 +147,11 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) = c &= char(t.kind) case t.kind + of tyBool, tyChar, tyInt..tyUInt64: + # no canonicalization for integral types, so that e.g. ``pid_t`` is + # produced instead of ``NI``: + if t.sym != nil and {sfImportc, sfExportc} * t.sym.flags != {}: + c.hashSym(t.sym) of tyObject, tyEnum: if t.typeInst != nil: assert t.typeInst.kind == tyGenericInst @@ -162,8 +167,9 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) = c.hashSym(t.sym) else: c &= t.id - of tyRef, tyPtr, tyGenericBody: + of tyRef, tyPtr, tyGenericBody, tyVar: c.hashType t.lastSon, flags + if tfVarIsPtr in t.flags: c &= ".varisptr" of tyUserTypeClass: if t.sym != nil and t.sym.owner != nil: c &= t.sym.owner.name.s