diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index 97ff4a7fc..a05ef7a28 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -101,10 +101,7 @@ proc newOpCall(op: PSym; x: PNode): PNode = proc destructorCall(c: PContext; op: PSym; x: PNode): PNode = result = newNodeIT(nkCall, x.info, op.typ.sons[0]) result.add(newSymNode(op)) - if destructor in c.features: - result.add genAddr(c, x) - else: - result.add x + result.add genAddr(c, x) proc newDeepCopyCall(op: PSym; x, y: PNode): PNode = result = newAsgnStmt(x, newOpCall(op, y)) @@ -319,7 +316,7 @@ 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. ## The later 'destroyer' pass depends on it. - if destructor notin c.features or not hasDestructor(typ): return + if not hasDestructor(typ): return when false: # do not produce wrong liftings while we're still instantiating generics: # now disabled; breaks topttree.nim! diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index f5f5915d4..55cf05094 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1556,12 +1556,7 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode = typeMismatch(c.config, n.info, lhs.typ, rhsTyp) n.sons[1] = fitNode(c, le, rhs, n.info) - if destructor notin c.features: - if tfHasAsgn in lhs.typ.flags and not lhsIsResult and - mode != noOverloadedAsgn: - return overloadedAsgn(c, lhs, n.sons[1]) - else: - liftTypeBoundOps(c, lhs.typ, lhs.info) + liftTypeBoundOps(c, lhs.typ, lhs.info) fixAbstractType(c, n) asgnToResultVar(c, n, n.sons[0], n.sons[1]) diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 22ea09af1..ff7cb0bb0 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -369,10 +369,7 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = assert newbody.kind in {tyRef, tyPtr} assert newbody.lastSon.typeInst == nil newbody.lastSon.typeInst = result - if destructor in cl.c.features: - cl.c.typesWithOps.add((newbody, result)) - else: - typeBound(cl.c, newbody, result, assignment, cl.info) + cl.c.typesWithOps.add((newbody, result)) let methods = skipTypes(bbody, abstractPtrs).methods for col, meth in items(methods): # we instantiate the known methods belonging to that type, this causes @@ -546,7 +543,6 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = else: discard proc instAllTypeBoundOp*(c: PContext, info: TLineInfo) = - if destructor notin c.features: return var i = 0 while i < c.typesWithOps.len: let (newty, oldty) = c.typesWithOps[i]