diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 4b9dd3e7a4880..22167d153f922 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1837,6 +1837,18 @@ proc typeSectionFinalPass(c: PContext, n: PNode) = for (owner, field, expectedType) in c.forwardFieldUpdates: semDelayedFieldDefault(c, owner, expectedType, field) c.forwardFieldUpdates = @[] + + # every type in the section started out as a `tyForward`, so types that were + # referenced before their definition could not propagate `tfHasAsgn` and + # friends to their owners yet. Now that all bodies are known, redo it: + block: + var marker = initIntSet() + for i in 0..