Skip to content

Commit f191ba8

Browse files
authored
fixes #25048; Closure environment wrongly marked as cyclic (#25220)
fixes #25048 ```nim proc canFormAcycleAux = of tyObject: # Inheritance can introduce cyclic types, however this is not relevant # as the type that is passed to 'new' is statically known! # er but we use it also for the write barrier ... if tfFinal notin t.flags: # damn inheritance may introduce cycles: result = true ``` It seems that all objects without `tfFinal` in their flags are registering cycles. It doesn't seem that `Env` can be a cyclic type because of inheritance since it is not going to be inherited after all by another `Env` object type
1 parent fb4a82f commit f191ba8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/lambdalifting.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ template isIterator*(owner: PSym): bool =
150150

151151
proc createEnvObj(g: ModuleGraph; idgen: IdGenerator; owner: PSym; info: TLineInfo): PType =
152152
result = createObj(g, idgen, owner, info, final=false)
153+
result.flags.incl tfFinal
153154
if owner.isIterator:
154155
rawAddField(result, createStateField(g, owner, idgen))
155156

0 commit comments

Comments
 (0)