diff options
-rw-r--r-- | compiler/semtypes.nim | 6 | ||||
-rw-r--r-- | tests/arc/tarcmisc.nim | 18 |
2 files changed, 19 insertions, 5 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 275ad8a07..1aabe435f 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -942,10 +942,8 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = t.rawAddSonNoPropagationOfTypeFlags result result = t else: discard - #if result.kind == tyRef and c.config.selectedGC == gcDestructors: - # result.flags.incl tfHasAsgn - # XXX Something like this is a good idea but it should be done - # in sempass2! + if result.kind == tyRef and c.config.selectedGC in {gcArc, gcOrc}: + result.flags.incl tfHasAsgn proc findEnforcedStaticType(t: PType): PType = # This handles types such as `static[T] and Foo`, diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 79c947e82..24f02959c 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -3,6 +3,7 @@ discard """ 123xyzabc destroyed: false destroyed: false +1 closed destroying variable ''' @@ -118,4 +119,19 @@ proc free*(game: Game) = proc newGame*(): Game = new(result, free) -var game*: Game \ No newline at end of file +var game*: Game + + +#------------------------------------------------------------------------------ +# issue #14333 + +type + SimpleLoop = object + + Lsg = object + loops: seq[ref SimpleLoop] + root: ref SimpleLoop + +var lsg: Lsg +lsg.loops.add lsg.root +echo lsg.loops.len \ No newline at end of file |