* fix #14294

* fix orc as well

Co-authored-by: cooldome <ariabushenko@bk.ru>
This commit is contained in:
cooldome 2020-05-11 18:10:54 +01:00 • committed by GitHub
commit fee71d466c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View file

@ -448,7 +448,8 @@ proc useSeqOrStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
case c.kind case c.kind
of attachedAsgn, attachedDeepCopy: of attachedAsgn, attachedDeepCopy:
doAssert t.assignment != nil if t.assignment == nil:
return # protect from recursion
body.add newHookCall(c.g, t.assignment, x, y) body.add newHookCall(c.g, t.assignment, x, y)
of attachedSink: of attachedSink:
# we always inline the move for better performance: # we always inline the move for better performance:
@ -465,8 +466,12 @@ proc useSeqOrStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
doAssert t.destructor != nil doAssert t.destructor != nil
body.add destructorCall(c, t.destructor, x) body.add destructorCall(c, t.destructor, x)
of attachedTrace: of attachedTrace:
if t.attachedOps[c.kind] == nil:
return # protect from recursion
body.add newHookCall(c.g, t.attachedOps[c.kind], x, y) body.add newHookCall(c.g, t.attachedOps[c.kind], x, y)
of attachedDispose: of attachedDispose:
if t.attachedOps[c.kind] == nil:
return # protect from recursion
body.add newHookCall(c.g, t.attachedOps[c.kind], x, nil) body.add newHookCall(c.g, t.attachedOps[c.kind], x, nil)
proc fillStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = proc fillStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =

View file

@ -6,7 +6,9 @@ Success
Hello Hello
1 1
2 2
0''' 0
List
'''
cmd: '''nim c --gc:arc $file''' cmd: '''nim c --gc:arc $file'''
""" """
@ -145,3 +147,25 @@ proc bug13105 =
bug13105() bug13105()
echo getOccupiedMem() - startMem echo getOccupiedMem() - startMem
#------------------------------------------------------------------------------
# issue #14294
import tables
type
TagKind = enum
List = 0, Compound
Tag = object
case kind: TagKind
of List:
values: seq[Tag]
of Compound:
compound: Table[string, Tag]
var a = Tag(kind: List)
var b = a
echo a.kind
var c = a