diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-01-03 23:48:27 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-01-04 05:44:29 +0000 |
| commit | f818098971fdafdaaa6af4b927f2cf47332ed5f7 (patch) | |
| tree | 68692d31a8c939887864ec302d8e8378c7c87cfd /src/Sema.zig | |
| parent | 814491f59921600b8a0137733b48d4b0f6b99d78 (diff) | |
| download | zig-f818098971fdafdaaa6af4b927f2cf47332ed5f7.tar.gz zig-f818098971fdafdaaa6af4b927f2cf47332ed5f7.zip | |
incremental: correctly return `error.AnalysisFail` when type structure changes
`Zcu.PerThead.ensureTypeUpToDate` is set up in such a way that it only
returns the updated type the first time it is called. In general, that's
okay; however, the exception is that we want the function to continue
returning `error.AnalysisFail` when the type has been lost, or its
number of captures changed.
Therefore, the check for this case now happens before the up-to-date
success return.
For simplicity, the number of captures is now handled by intentionally
losing the instruction in `Zcu.mapOldZirToNew`, since there is nothing
to gain from tracking a type when old instances of it can never be
reused.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 0ec1a24939..4a977664ef 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -18172,7 +18172,9 @@ fn zirThis( _ = extended; const pt = sema.pt; const namespace = pt.zcu.namespacePtr(block.namespace); + const new_ty = try pt.ensureTypeUpToDate(namespace.owner_type); + switch (pt.zcu.intern_pool.indexToKey(new_ty)) { .struct_type, .union_type, .enum_type => try sema.declareDependency(.{ .interned = new_ty }), .opaque_type => {}, |
