diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-10-17 22:04:40 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-10-17 22:04:40 +0200 |
commit | 35c8b5e3bcc13ade6441f1b53ee8d3acacffded3 (patch) | |
tree | ca864971f79b15ce7e3c5b4e67012f9e67b9a9f0 /compiler | |
parent | e7f37d7223920939cda1a206cc84efee41952437 (diff) | |
download | Nim-35c8b5e3bcc13ade6441f1b53ee8d3acacffded3.tar.gz |
destructors: irresponsibly simple tcustomseq test works
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semasgn.nim | 13 | ||||
-rw-r--r-- | compiler/semtypinst.nim | 5 |
2 files changed, 7 insertions, 11 deletions
diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index 19d31ec73..cb4728097 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -318,16 +318,9 @@ proc overloadedAsgn(c: PContext; dest, src: PNode): PNode = proc liftTypeBoundOps*(c: PContext; typ: PType; info: TLineInfo) = ## In the semantic pass this is called in strategic places ## to ensure we lift assignment, destructors and moves properly. - ## Since this is done in the sem* routines generics already have - ## been resolved for us and do not complicate the logic any further. - ## We have to ensure that the 'tfHasDesctructor' flags bubbles up - ## in the generic instantiations though. ## The later 'destroyer' pass depends on it. if not newDestructors or not hasDestructor(typ): return # we generate the destructor first so that other operators can depend on it: - if typ.destructor == nil: - liftBody(c, typ, attachedDestructor, info) - if typ.assignment == nil: - liftBody(c, typ, attachedAsgn, info) - if typ.sink == nil: - liftBody(c, typ, attachedSink, info) + if typ.destructor == nil: liftBody(c, typ, attachedDestructor, info) + if typ.assignment == nil: liftBody(c, typ, attachedAsgn, info) + if typ.sink == nil: liftBody(c, typ, attachedSink, info) diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 5d0f0177c..3b99ea562 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -363,7 +363,10 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = # '=' needs to be instantiated for generics when the type is constructed: newbody.field = cl.c.instTypeBoundOp(cl.c, opr, result, cl.info, attachedAsgn, 1) - if not newDestructors: typeBound(assignment) + if newDestructors: + typeBound(destructor) + typeBound(sink) + typeBound(assignment) let methods = skipTypes(bbody, abstractPtrs).methods for col, meth in items(methods): # we instantiate the known methods belonging to that type, this causes |