diff options
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index b325e6d42..9ce102c2f 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -479,7 +479,7 @@ type tfNoSideEffect, # procedure type does not allow side effects tfFinal, # is the object final? tfInheritable, # is the object inheritable? - tfAcyclic, # type is acyclic (for GC optimization) + tfHasOwned, # type contains an 'owned' type and must be moved tfEnumHasHoles, # enum cannot be mapped into a range tfShallow, # type can be shallow copied on assignment tfThread, # proc type is marked as ``thread``; alias for ``gcsafe`` @@ -1472,6 +1472,13 @@ proc propagateToOwner*(owner, elem: PType) = o2.flags.incl tfHasAsgn owner.flags.incl tfHasAsgn + if tfHasOwned in elem.flags: + let o2 = owner.skipTypes({tyGenericInst, tyAlias, tySink}) + if o2.kind in {tyTuple, tyObject, tyArray, + tySequence, tyOpt, tySet, tyDistinct}: + o2.flags.incl tfHasOwned + owner.flags.incl tfHasOwned + if owner.kind notin {tyProc, tyGenericInst, tyGenericBody, tyGenericInvocation, tyPtr}: let elemB = elem.skipTypes({tyGenericInst, tyAlias, tySink}) |