Skip to content

Commit b1c68bb

Browse files
authored
fixes #25611; t.state != Sealed (#25622)
fixes #25611 This pull request updates the `propagateToOwner` procedure in `compiler/ast.nim` to handle sealed types more robustly during incremental compilation (IC) reloads. The main change is the addition of an assertion to ensure that sealed types already have the necessary propagated flags, preventing incorrect state during IC reloads. Handling of sealed types and propagated flags: * Added a check for `Sealed` state on `o2` (the owner type), and included an assertion to verify that sealed types already have the required propagated flags (`tfHasAsgn`/`tfHasOwned`) during IC reloads, instead of redundantly setting them.
1 parent 4bf44ca commit b1c68bb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/ast.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,12 @@ proc propagateToOwner*(owner, elem: PType; propagateHasAsgn = true) =
11961196
let o2 = owner.skipTypes({tyGenericInst, tyAlias, tySink})
11971197
if o2.kind in {tyTuple, tyObject, tyArray,
11981198
tySequence, tyString, tySet, tyDistinct}:
1199-
o2.incl mask
1199+
if o2.state == Sealed:
1200+
# During the original compilation, propagateToOwner set tfHasAsgn/tfHasOwned on the type before it was sealed
1201+
# On IC reload, the sealed type already has those flags
1202+
assert mask <= o2.flags, "IC bug: sealed type missing propagated flags"
1203+
else:
1204+
o2.incl mask
12001205
owner.incl mask
12011206

12021207
if owner.kind notin {tyProc, tyGenericInst, tyGenericBody,

0 commit comments

Comments
 (0)