summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-09-13 18:12:38 +0200
committerAraq <rumpf_a@web.de>2019-09-13 18:12:38 +0200
commit5018e7f304969365f52f57ff0ef8170e65d914b5 (patch)
treea290e2740dc3cdcfbefe28ae91cc3e6bf18626cf
parentee6df5bd247685d01d96c05878f85b053904d3fa (diff)
downloadNim-5018e7f304969365f52f57ff0ef8170e65d914b5.tar.gz
fixes #12172
-rw-r--r--compiler/injectdestructors.nim4
-rw-r--r--compiler/liftdestructors.nim2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index 7c2a15ce3..e66f4f25b 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -134,7 +134,7 @@ to do it.
 ]#
 
 import
-  intsets, ast, msgs, renderer, magicsys, types, idents,
+  intsets, ast, astalgo, msgs, renderer, magicsys, types, idents,
   strutils, options, dfa, lowerings, tables, modulegraphs, msgs,
   lineinfos, parampatterns, sighashes
 
@@ -322,7 +322,7 @@ proc makePtrType(c: Con, baseType: PType): PType =
 proc genOp(c: Con; t: PType; kind: TTypeAttachedOp; dest, ri: PNode): PNode =
   var op = t.attachedOps[kind]
 
-  if op == nil:
+  if op == nil or op.ast[genericParamsPos].kind != nkEmpty:
     # give up and find the canonical type instead:
     let h = sighashes.hashType(t, {CoType, CoConsiderOwned, CoDistinct})
     let canon = c.graph.canonTypes.getOrDefault(h)
diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim
index 14bbc3ba7..0f7273656 100644
--- a/compiler/liftdestructors.nim
+++ b/compiler/liftdestructors.nim
@@ -641,7 +641,7 @@ proc createTypeBoundOps(g: ModuleGraph; c: PContext; orig: PType; info: TLineInf
     let typ = orig.skipTypes({tyGenericInst, tyAlias, tySink})
     g.canonTypes[h] = typ
     canon = typ
-  elif canon != orig:
+  if canon != orig:
     overwrite = true
 
   # multiple cases are to distinguish here: