Commit c4ec382fc8
Changed files (4)
src
src/Sema/LowerZon.zig
@@ -157,13 +157,14 @@ fn lowerExprAnonResTy(self: *LowerZon, node: Zoir.Node.Index) CompileError!Inter
)) {
.wip => |wip| ty: {
errdefer wip.cancel(ip, pt.tid);
- wip.setName(ip, try self.sema.createTypeName(
+ const type_name = try self.sema.createTypeName(
self.block,
.anon,
"struct",
self.base_node_inst.resolve(ip),
wip.index,
- ));
+ );
+ wip.setName(ip, type_name.name, type_name.nav);
const struct_type = ip.loadStructType(wip.index);
src/Zcu/PerThread.zig
@@ -1787,7 +1787,7 @@ fn createFileRootStruct(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try file.internFullyQualifiedName(pt));
+ wip_ty.setName(ip, try file.internFullyQualifiedName(pt), .none);
ip.namespacePtr(namespace_index).owner_type = wip_ty.index;
if (zcu.comp.incremental) {
@@ -3976,7 +3976,7 @@ fn recreateStructType(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, struct_obj.name);
+ wip_ty.setName(ip, struct_obj.name, struct_obj.name_nav);
try pt.addDependency(.wrap(.{ .type = wip_ty.index }), .{ .src_hash = key.zir_index });
zcu.namespacePtr(struct_obj.namespace).owner_type = wip_ty.index;
// No need to re-scan the namespace -- `zirStructDecl` will ultimately do that if the type is still alive.
@@ -4068,7 +4068,7 @@ fn recreateUnionType(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, union_obj.name);
+ wip_ty.setName(ip, union_obj.name, union_obj.name_nav);
try pt.addDependency(.wrap(.{ .type = wip_ty.index }), .{ .src_hash = key.zir_index });
zcu.namespacePtr(namespace_index).owner_type = wip_ty.index;
// No need to re-scan the namespace -- `zirUnionDecl` will ultimately do that if the type is still alive.
@@ -4177,7 +4177,7 @@ fn recreateEnumType(
var done = true;
errdefer if (!done) wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, enum_obj.name);
+ wip_ty.setName(ip, enum_obj.name, enum_obj.name_nav);
zcu.namespacePtr(namespace_index).owner_type = wip_ty.index;
// No need to re-scan the namespace -- `zirEnumDecl` will ultimately do that if the type is still alive.
src/InternPool.zig
@@ -3249,6 +3249,9 @@ pub const LoadedUnionType = struct {
name: NullTerminatedString,
/// Represents the declarations inside this union.
namespace: NamespaceIndex,
+ /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
+ /// Otherwise, this is `.none`.
+ name_nav: Nav.Index.Optional,
/// The enum tag type.
enum_tag_ty: Index,
/// List of field types in declaration order.
@@ -3567,6 +3570,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType {
.tid = unwrapped_index.tid,
.extra_index = data,
.name = type_union.data.name,
+ .name_nav = type_union.data.name_nav,
.namespace = type_union.data.namespace,
.enum_tag_ty = type_union.data.tag_ty,
.field_types = field_types,
@@ -3584,6 +3588,9 @@ pub const LoadedStructType = struct {
/// The name of this struct type.
name: NullTerminatedString,
namespace: NamespaceIndex,
+ /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
+ /// Otherwise, or if this is a file's root struct type, this is `.none`.
+ name_nav: Nav.Index.Optional,
/// Index of the `struct_decl` or `reify` ZIR instruction.
zir_index: TrackedInst.Index,
layout: std.builtin.Type.ContainerLayout,
@@ -4173,6 +4180,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
switch (item.tag) {
.type_struct => {
const name: NullTerminatedString = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "name").?]);
+ const name_nav: Nav.Index.Optional = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?]);
const namespace: NamespaceIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?]);
const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?]);
const fields_len = extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "fields_len").?];
@@ -4259,6 +4267,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
.tid = unwrapped_index.tid,
.extra_index = item.data,
.name = name,
+ .name_nav = name_nav,
.namespace = namespace,
.zir_index = zir_index,
.layout = if (flags.is_extern) .@"extern" else .auto,
@@ -4275,6 +4284,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
},
.type_struct_packed, .type_struct_packed_inits => {
const name: NullTerminatedString = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?]);
+ const name_nav: Nav.Index.Optional = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?]);
const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "zir_index").?]);
const fields_len = extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "fields_len").?];
const namespace: NamespaceIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?]);
@@ -4321,6 +4331,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
.tid = unwrapped_index.tid,
.extra_index = item.data,
.name = name,
+ .name_nav = name_nav,
.namespace = namespace,
.zir_index = zir_index,
.layout = .@"packed",
@@ -4345,6 +4356,9 @@ pub const LoadedEnumType = struct {
name: NullTerminatedString,
/// Represents the declarations inside this enum.
namespace: NamespaceIndex,
+ /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
+ /// Otherwise, this is `.none`.
+ name_nav: Nav.Index.Optional,
/// An integer type which is used for the numerical value of the enum.
/// This field is present regardless of whether the enum has an
/// explicitly provided tag type or auto-numbered.
@@ -4428,6 +4442,7 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType {
} else extra.data.captures_len;
return .{
.name = extra.data.name,
+ .name_nav = extra.data.name_nav,
.namespace = extra.data.namespace,
.tag_ty = extra.data.int_tag_type,
.names = .{
@@ -4462,6 +4477,7 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType {
} else extra.data.captures_len;
return .{
.name = extra.data.name,
+ .name_nav = extra.data.name_nav,
.namespace = extra.data.namespace,
.tag_ty = extra.data.int_tag_type,
.names = .{
@@ -4493,6 +4509,9 @@ pub const LoadedOpaqueType = struct {
// TODO: the non-fqn will be needed by the new dwarf structure
/// The name of this opaque type.
name: NullTerminatedString,
+ /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
+ /// Otherwise, this is `.none`.
+ name_nav: Nav.Index.Optional,
/// Index of the `opaque_decl` or `reify` instruction.
zir_index: TrackedInst.Index,
captures: CaptureValue.Slice,
@@ -4509,6 +4528,7 @@ pub fn loadOpaqueType(ip: *const InternPool, index: Index) LoadedOpaqueType {
extra.data.captures_len;
return .{
.name = extra.data.name,
+ .name_nav = extra.data.name_nav,
.namespace = extra.data.namespace,
.zir_index = extra.data.zir_index,
.captures = .{
@@ -6022,6 +6042,7 @@ pub const Tag = enum(u8) {
/// 4. field align: Alignment for each field; declaration order
pub const TypeUnion = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
flags: Flags,
/// This could be provided through the tag type, but it is more convenient
/// to store it directly. This is also necessary for `dumpStatsFallible` to
@@ -6061,6 +6082,7 @@ pub const Tag = enum(u8) {
/// 5. init: Index for each fields_len // if tag is type_struct_packed_inits
pub const TypeStructPacked = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
zir_index: TrackedInst.Index,
fields_len: u32,
namespace: NamespaceIndex,
@@ -6108,6 +6130,7 @@ pub const Tag = enum(u8) {
/// 8. field_offset: u32 // for each field in declared order, undef until layout_resolved
pub const TypeStruct = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
zir_index: TrackedInst.Index,
namespace: NamespaceIndex,
fields_len: u32,
@@ -6151,6 +6174,7 @@ pub const Tag = enum(u8) {
/// 0. capture: CaptureValue // for each `captures_len`
pub const TypeOpaque = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
/// Contains the declarations inside this opaque.
namespace: NamespaceIndex,
/// The index of the `opaque_decl` instruction.
@@ -6429,6 +6453,7 @@ pub const Array = struct {
/// 4. tag value: Index for each fields_len; declaration order
pub const EnumExplicit = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
/// `std.math.maxInt(u32)` indicates this type is reified.
captures_len: u32,
namespace: NamespaceIndex,
@@ -6454,6 +6479,7 @@ pub const EnumExplicit = struct {
/// 3. field name: NullTerminatedString for each fields_len; declaration order
pub const EnumAuto = struct {
name: NullTerminatedString,
+ name_nav: Nav.Index.Optional,
/// `std.math.maxInt(u32)` indicates this type is reified.
captures_len: u32,
namespace: NamespaceIndex,
@@ -8666,6 +8692,7 @@ pub fn getUnionType(
.size = std.math.maxInt(u32),
.padding = std.math.maxInt(u32),
.name = undefined, // set by `finish`
+ .name_nav = undefined, // set by `finish`
.namespace = undefined, // set by `finish`
.tag_ty = ini.enum_tag_ty,
.zir_index = switch (ini.key) {
@@ -8717,6 +8744,7 @@ pub fn getUnionType(
.tid = tid,
.index = gop.put(),
.type_name_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?,
} };
}
@@ -8726,15 +8754,20 @@ pub const WipNamespaceType = struct {
index: Index,
type_name_extra_index: u32,
namespace_extra_index: u32,
+ name_nav_extra_index: u32,
pub fn setName(
wip: WipNamespaceType,
ip: *InternPool,
type_name: NullTerminatedString,
+ /// This should be the `Nav` we are named after if we use the `.parent` name strategy; `.none` otherwise.
+ /// This is also `.none` if we use `.parent` because we are the root struct type for a file.
+ name_nav: Nav.Index.Optional,
) void {
const extra = ip.getLocalShared(wip.tid).extra.acquire();
const extra_items = extra.view().items(.@"0");
extra_items[wip.type_name_extra_index] = @intFromEnum(type_name);
+ extra_items[wip.name_nav_extra_index] = @intFromEnum(name_nav);
}
pub fn finish(
@@ -8843,6 +8876,7 @@ pub fn getStructType(
ini.fields_len); // inits
const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStructPacked{
.name = undefined, // set by `finish`
+ .name_nav = undefined, // set by `finish`
.zir_index = zir_index,
.fields_len = ini.fields_len,
.namespace = undefined, // set by `finish`
@@ -8887,6 +8921,7 @@ pub fn getStructType(
.tid = tid,
.index = gop.put(),
.type_name_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?,
} };
},
@@ -8909,6 +8944,7 @@ pub fn getStructType(
1); // names_map
const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{
.name = undefined, // set by `finish`
+ .name_nav = undefined, // set by `finish`
.zir_index = zir_index,
.namespace = undefined, // set by `finish`
.fields_len = ini.fields_len,
@@ -8977,6 +9013,7 @@ pub fn getStructType(
.tid = tid,
.index = gop.put(),
.type_name_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?,
} };
}
@@ -9766,6 +9803,7 @@ pub const WipEnumType = struct {
tag_ty_index: u32,
type_name_extra_index: u32,
namespace_extra_index: u32,
+ name_nav_extra_index: u32,
names_map: MapIndex,
names_start: u32,
values_map: OptionalMapIndex,
@@ -9775,10 +9813,13 @@ pub const WipEnumType = struct {
wip: WipEnumType,
ip: *InternPool,
type_name: NullTerminatedString,
+ /// This should be the `Nav` we are named after if we use the `.parent` name strategy; `.none` otherwise.
+ name_nav: Nav.Index.Optional,
) void {
const extra = ip.getLocalShared(wip.tid).extra.acquire();
const extra_items = extra.view().items(.@"0");
extra_items[wip.type_name_extra_index] = @intFromEnum(type_name);
+ extra_items[wip.name_nav_extra_index] = @intFromEnum(name_nav);
}
pub fn prepare(
@@ -9893,6 +9934,7 @@ pub fn getEnumType(
const extra_index = addExtraAssumeCapacity(extra, EnumAuto{
.name = undefined, // set by `prepare`
+ .name_nav = undefined, // set by `prepare`
.captures_len = switch (ini.key) {
inline .declared, .declared_owned_captures => |d| @intCast(d.captures.len),
.reified => std.math.maxInt(u32),
@@ -9921,6 +9963,7 @@ pub fn getEnumType(
.index = gop.put(),
.tag_ty_index = extra_index + std.meta.fieldIndex(EnumAuto, "int_tag_type").?,
.type_name_extra_index = extra_index + std.meta.fieldIndex(EnumAuto, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(EnumAuto, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(EnumAuto, "namespace").?,
.names_map = names_map,
.names_start = @intCast(names_start),
@@ -9950,6 +9993,7 @@ pub fn getEnumType(
const extra_index = addExtraAssumeCapacity(extra, EnumExplicit{
.name = undefined, // set by `prepare`
+ .name_nav = undefined, // set by `prepare`
.captures_len = switch (ini.key) {
inline .declared, .declared_owned_captures => |d| @intCast(d.captures.len),
.reified => std.math.maxInt(u32),
@@ -9987,6 +10031,7 @@ pub fn getEnumType(
.index = gop.put(),
.tag_ty_index = extra_index + std.meta.fieldIndex(EnumExplicit, "int_tag_type").?,
.type_name_extra_index = extra_index + std.meta.fieldIndex(EnumExplicit, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(EnumExplicit, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(EnumExplicit, "namespace").?,
.names_map = names_map,
.names_start = @intCast(names_start),
@@ -10055,6 +10100,7 @@ pub fn getGeneratedTagEnumType(
.tag = .type_enum_auto,
.data = addExtraAssumeCapacity(extra, EnumAuto{
.name = ini.name,
+ .name_nav = .none,
.captures_len = 0,
.namespace = namespace,
.int_tag_type = ini.tag_ty,
@@ -10088,6 +10134,7 @@ pub fn getGeneratedTagEnumType(
},
.data = addExtraAssumeCapacity(extra, EnumExplicit{
.name = ini.name,
+ .name_nav = .none,
.captures_len = 0,
.namespace = namespace,
.int_tag_type = ini.tag_ty,
@@ -10161,6 +10208,7 @@ pub fn getOpaqueType(
});
const extra_index = addExtraAssumeCapacity(extra, Tag.TypeOpaque{
.name = undefined, // set by `finish`
+ .name_nav = undefined, // set by `finish`
.namespace = undefined, // set by `finish`
.zir_index = switch (ini.key) {
inline else => |x| x.zir_index,
@@ -10183,6 +10231,7 @@ pub fn getOpaqueType(
.tid = tid,
.index = gop.put(),
.type_name_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name").?,
+ .name_nav_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name_nav").?,
.namespace_extra_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "namespace").?,
},
};
@@ -10299,6 +10348,7 @@ fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 {
extra.appendAssumeCapacity(.{switch (field.type) {
Index,
Nav.Index,
+ Nav.Index.Optional,
NamespaceIndex,
OptionalNamespaceIndex,
MapIndex,
@@ -10361,6 +10411,7 @@ fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { dat
@field(result, field.name) = switch (field.type) {
Index,
Nav.Index,
+ Nav.Index.Optional,
NamespaceIndex,
OptionalNamespaceIndex,
MapIndex,
src/Sema.zig
@@ -2963,13 +2963,14 @@ fn zirStructDecl(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
small.name_strategy,
"struct",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -3007,7 +3008,10 @@ pub fn createTypeName(
inst: ?Zir.Inst.Index,
/// This is used purely to give the type a unique name in the `anon` case.
type_index: InternPool.Index,
-) !InternPool.NullTerminatedString {
+) !struct {
+ name: InternPool.NullTerminatedString,
+ nav: InternPool.Nav.Index.Optional,
+} {
const pt = sema.pt;
const zcu = pt.zcu;
const gpa = zcu.gpa;
@@ -3015,7 +3019,10 @@ pub fn createTypeName(
switch (name_strategy) {
.anon => {}, // handled after switch
- .parent => return block.type_name_ctx,
+ .parent => return .{
+ .name = block.type_name_ctx,
+ .nav = sema.owner.unwrap().nav_val.toOptional(),
+ },
.func => func_strat: {
const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail);
const zir_tags = sema.code.instructions.items(.tag);
@@ -3057,7 +3064,10 @@ pub fn createTypeName(
};
try writer.writeByte(')');
- return ip.getOrPutString(gpa, pt.tid, buf.items, .no_embedded_nulls);
+ return .{
+ .name = try ip.getOrPutString(gpa, pt.tid, buf.items, .no_embedded_nulls),
+ .nav = .none,
+ };
},
.dbg_var => {
// TODO: this logic is questionable. We ideally should be traversing the `Block` rather than relying on the order of AstGen instructions.
@@ -3066,9 +3076,12 @@ pub fn createTypeName(
const zir_data = sema.code.instructions.items(.data);
for (@intFromEnum(inst.?)..zir_tags.len) |i| switch (zir_tags[i]) {
.dbg_var_ptr, .dbg_var_val => if (zir_data[i].str_op.operand == ref) {
- return ip.getOrPutStringFmt(gpa, pt.tid, "{}.{s}", .{
- block.type_name_ctx.fmt(ip), zir_data[i].str_op.getStr(sema.code),
- }, .no_embedded_nulls);
+ return .{
+ .name = try ip.getOrPutStringFmt(gpa, pt.tid, "{}.{s}", .{
+ block.type_name_ctx.fmt(ip), zir_data[i].str_op.getStr(sema.code),
+ }, .no_embedded_nulls),
+ .nav = .none,
+ };
},
else => {},
};
@@ -3086,9 +3099,12 @@ pub fn createTypeName(
// types appropriately. However, `@typeName` becomes a problem then. If we remove
// that builtin from the language, we can consider this.
- return ip.getOrPutStringFmt(gpa, pt.tid, "{}__{s}_{d}", .{
- block.type_name_ctx.fmt(ip), anon_prefix, @intFromEnum(type_index),
- }, .no_embedded_nulls);
+ return .{
+ .name = try ip.getOrPutStringFmt(gpa, pt.tid, "{}__{s}_{d}", .{
+ block.type_name_ctx.fmt(ip), anon_prefix, @intFromEnum(type_index),
+ }, .no_embedded_nulls),
+ .nav = .none,
+ };
}
fn zirEnumDecl(
@@ -3209,7 +3225,7 @@ fn zirEnumDecl(
inst,
wip_ty.index,
);
- wip_ty.setName(ip, type_name);
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -3236,7 +3252,7 @@ fn zirEnumDecl(
inst,
tracked_inst,
new_namespace_index,
- type_name,
+ type_name.name,
small,
body,
tag_type_ref,
@@ -3340,13 +3356,14 @@ fn zirUnionDecl(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
small.name_strategy,
"union",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -3432,13 +3449,14 @@ fn zirOpaqueDecl(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
small.name_strategy,
"opaque",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -20062,7 +20080,8 @@ fn structInitAnon(
}, false)) {
.wip => |wip| ty: {
errdefer wip.cancel(ip, pt.tid);
- wip.setName(ip, try sema.createTypeName(block, .anon, "struct", inst, wip.index));
+ const type_name = try sema.createTypeName(block, .anon, "struct", inst, wip.index);
+ wip.setName(ip, type_name.name, type_name.nav);
const struct_type = ip.loadStructType(wip.index);
@@ -21122,13 +21141,14 @@ fn zirReify(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
name_strategy,
"opaque",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -21327,13 +21347,14 @@ fn reifyEnum(
return sema.fail(block, src, "Type.Enum.tag_type must be an integer type", .{});
}
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
name_strategy,
"enum",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const new_namespace_index = try pt.createNamespace(.{
.parent = block.namespace.toOptional(),
@@ -21498,7 +21519,7 @@ fn reifyUnion(
inst,
wip_ty.index,
);
- wip_ty.setName(ip, type_name);
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const field_types = try sema.arena.alloc(InternPool.Index, fields_len);
const field_aligns = if (any_aligns) try sema.arena.alloc(InternPool.Alignment, fields_len) else undefined;
@@ -21591,7 +21612,7 @@ fn reifyUnion(
}
}
- const enum_tag_ty = try sema.generateUnionTagTypeSimple(block, field_names.keys(), wip_ty.index, type_name);
+ const enum_tag_ty = try sema.generateUnionTagTypeSimple(block, field_names.keys(), wip_ty.index, type_name.name);
break :tag_ty .{ enum_tag_ty, false };
};
errdefer if (!has_explicit_tag) ip.remove(pt.tid, enum_tag_ty); // remove generated tag type on error
@@ -21853,13 +21874,14 @@ fn reifyStruct(
};
errdefer wip_ty.cancel(ip, pt.tid);
- wip_ty.setName(ip, try sema.createTypeName(
+ const type_name = try sema.createTypeName(
block,
name_strategy,
"struct",
inst,
wip_ty.index,
- ));
+ );
+ wip_ty.setName(ip, type_name.name, type_name.nav);
const struct_type = ip.loadStructType(wip_ty.index);