Value: add intern and unintern to facilitate code conversion

This allows some code (like struct initializers) to use interned types
while other code (such as comptime mutation) continues to use legacy
types.

With these changes, an `zig build-obj empty.zig` gets to a crash on
missing interned error union types.
This commit is contained in:
Jacob Young
2023-05-20 09:35:11 -04:00
committed by Andrew Kelley
parent be78a12d7d
commit 115c089562
6 changed files with 604 additions and 178 deletions

View File

@@ -5762,7 +5762,7 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air {
// Crucially, this happens *after* we set the function state to success above,
// so that dependencies on the function body will now be satisfied rather than
// result in circular dependency errors.
sema.resolveFnTypes(fn_ty_info) catch |err| switch (err) {
sema.resolveFnTypes(mod.typeToFunc(fn_ty).?) catch |err| switch (err) {
error.NeededSourceLocation => unreachable,
error.GenericPoison => unreachable,
error.ComptimeReturn => unreachable,