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

@@ -566,7 +566,7 @@ pub const DeclGen = struct {
try writer.writeAll("){ .ptr = ");
}
try dg.renderValue(writer, ty.slicePtrFieldType(mod), val.slicePtr(), .Initializer);
try dg.renderValue(writer, ty.slicePtrFieldType(mod), val.slicePtr(mod), .Initializer);
const len_val = try mod.intValue(Type.usize, val.sliceLen(mod));