authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-08-20 19:38:27-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-03 12:59:38-04:00
log4184767f7d92e8efca05756abb12cf4d448f3f7a
tree3e15afe7249eb5860f0186a2fdcaea9ee5147b60
parentc41b7d1b850ba998bd253461536d25b06bcb41cb

Sema: add unqualified container type names


13 files changed, 213 insertions(+), 106 deletions(-)

src/IncrementalDebugServer.zig+3-3
...@@ -243,7 +243,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const...@@ -243,7 +243,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const
243 var num_results: usize = 0;243 var num_results: usize = 0;
244 for (zcu.incremental_debug_state.types.keys()) |type_ip_index| {244 for (zcu.incremental_debug_state.types.keys()) |type_ip_index| {
245 const ty: Type = .fromInterned(type_ip_index);245 const ty: Type = .fromInterned(type_ip_index);
246 const ty_name = ty.containerTypeName(ip).toSlice(ip);246 const ty_name = ty.containerTypeName(ip).fqn.toSlice(ip);
247 const success = switch (@as(u2, @intFromBool(anchor_start)) << 1 | @intFromBool(anchor_end)) {247 const success = switch (@as(u2, @intFromBool(anchor_start)) << 1 | @intFromBool(anchor_end)) {
248 0b00 => std.mem.find(u8, ty_name, query) != null,248 0b00 => std.mem.find(u8, ty_name, query) != null,
249 0b01 => std.mem.endsWith(u8, ty_name, query),249 0b01 => std.mem.endsWith(u8, ty_name, query),
...@@ -347,7 +347,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const...@@ -347,7 +347,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const
347 \\created on generation: {d}347 \\created on generation: {d}
348 \\348 \\
349 , .{349 , .{
350 Type.fromInterned(ip_index).containerTypeName(ip).fmt(ip),350 Type.fromInterned(ip_index).containerTypeName(ip).fqn.fmt(ip),
351 create_gen,351 create_gen,
352 });352 });
353 } else if (std.mem.eql(u8, cmd_str, "type_namespace")) {353 } else if (std.mem.eql(u8, cmd_str, "type_namespace")) {
...@@ -451,7 +451,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void {...@@ -451,7 +451,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void {
451 .union_type,451 .union_type,
452 .enum_type,452 .enum_type,
453 .opaque_type,453 .opaque_type,
454 => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @backingInt(ty.toIntern()) }),454 => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fqn.fmt(ip), @backingInt(ty.toIntern()) }),
455455
456 else => unreachable,456 else => unreachable,
457 }457 }
src/InternPool.zig+47-4
...@@ -3207,9 +3207,10 @@ pub const LoadedStructType = struct {...@@ -3207,9 +3207,10 @@ pub const LoadedStructType = struct {
3207 captures: CaptureValue.Slice,3207 captures: CaptureValue.Slice,
3208 is_reified: bool,3208 is_reified: bool,
32093209
3210 // TODO: the non-fqn will be needed by the new dwarf structure
3211 /// The name of this struct type.3210 /// The name of this struct type.
3212 name: NullTerminatedString,3211 name: NullTerminatedString,
3212 /// The fully-qualified name of this struct type.
3213 fqn: NullTerminatedString,
3213 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.3214 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
3214 /// Otherwise, or if this is a file's root struct type, this is `.none`.3215 /// Otherwise, or if this is a file's root struct type, this is `.none`.
3215 name_nav: Nav.Index.Optional,3216 name_nav: Nav.Index.Optional,
...@@ -3390,9 +3391,10 @@ pub const LoadedUnionType = struct {...@@ -3390,9 +3391,10 @@ pub const LoadedUnionType = struct {
3390 captures: CaptureValue.Slice,3391 captures: CaptureValue.Slice,
3391 is_reified: bool,3392 is_reified: bool,
33923393
3393 // TODO: the non-fqn will be needed by the new dwarf structure
3394 /// The name of this union type.3394 /// The name of this union type.
3395 name: NullTerminatedString,3395 name: NullTerminatedString,
3396 /// The fully-qualified name of this union type.
3397 fqn: NullTerminatedString,
3396 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.3398 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
3397 /// Otherwise, this is `.none`.3399 /// Otherwise, this is `.none`.
3398 name_nav: Nav.Index.Optional,3400 name_nav: Nav.Index.Optional,
...@@ -3457,9 +3459,10 @@ pub const LoadedEnumType = struct {...@@ -3457,9 +3459,10 @@ pub const LoadedEnumType = struct {
3457 owner_union: Index,3459 owner_union: Index,
3458 is_reified: bool,3460 is_reified: bool,
34593461
3460 // TODO: the non-fqn will be needed by the new dwarf structure
3461 /// The name of this enum type.3462 /// The name of this enum type.
3462 name: NullTerminatedString,3463 name: NullTerminatedString,
3464 /// The fully-qualified name of this enum type.
3465 fqn: NullTerminatedString,
3463 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.3466 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
3464 /// Otherwise, this is `.none`.3467 /// Otherwise, this is `.none`.
3465 name_nav: Nav.Index.Optional,3468 name_nav: Nav.Index.Optional,
...@@ -3519,9 +3522,10 @@ pub const LoadedOpaqueType = struct {...@@ -3519,9 +3522,10 @@ pub const LoadedOpaqueType = struct {
3519 zir_index: TrackedInst.Index,3522 zir_index: TrackedInst.Index,
3520 captures: CaptureValue.Slice,3523 captures: CaptureValue.Slice,
35213524
3522 // TODO: the non-fqn will be needed by the new dwarf structure
3523 /// The name of this opaque type.3525 /// The name of this opaque type.
3524 name: NullTerminatedString,3526 name: NullTerminatedString,
3527 /// The fully-qualified name of this opaque type.
3528 fqn: NullTerminatedString,
3525 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.3529 /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after.
3526 /// Otherwise, this is `.none`.3530 /// Otherwise, this is `.none`.
3527 name_nav: Nav.Index.Optional,3531 name_nav: Nav.Index.Optional,
...@@ -3607,6 +3611,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {...@@ -3607,6 +3611,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
3607 .captures = captures,3611 .captures = captures,
3608 .is_reified = extra.data.flags.any_captures == .reified,3612 .is_reified = extra.data.flags.any_captures == .reified,
3609 .name = extra.data.name,3613 .name = extra.data.name,
3614 .fqn = extra.data.fqn,
3610 .name_nav = extra.data.name_nav,3615 .name_nav = extra.data.name_nav,
3611 .namespace = extra.data.namespace,3616 .namespace = extra.data.namespace,
3612 .layout = switch (extra.data.flags.layout) {3617 .layout = switch (extra.data.flags.layout) {
...@@ -3670,6 +3675,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {...@@ -3670,6 +3675,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
3670 .captures = captures,3675 .captures = captures,
3671 .is_reified = extra.data.bits.captures_len == .reified,3676 .is_reified = extra.data.bits.captures_len == .reified,
3672 .name = extra.data.name,3677 .name = extra.data.name,
3678 .fqn = extra.data.fqn,
3673 .name_nav = extra.data.name_nav,3679 .name_nav = extra.data.name_nav,
3674 .namespace = extra.data.namespace,3680 .namespace = extra.data.namespace,
3675 .layout = .@"packed",3681 .layout = .@"packed",
...@@ -3745,6 +3751,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType {...@@ -3745,6 +3751,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType {
3745 .captures = captures,3751 .captures = captures,
3746 .is_reified = extra.data.flags.any_captures == .reified,3752 .is_reified = extra.data.flags.any_captures == .reified,
3747 .name = extra.data.name,3753 .name = extra.data.name,
3754 .fqn = extra.data.fqn,
3748 .name_nav = extra.data.name_nav,3755 .name_nav = extra.data.name_nav,
3749 .namespace = extra.data.namespace,3756 .namespace = extra.data.namespace,
3750 .layout = switch (extra.data.flags.layout) {3757 .layout = switch (extra.data.flags.layout) {
...@@ -3800,6 +3807,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType {...@@ -3800,6 +3807,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType {
3800 .captures = captures,3807 .captures = captures,
3801 .is_reified = extra.data.bits.captures_len == .reified,3808 .is_reified = extra.data.bits.captures_len == .reified,
3802 .name = extra.data.name,3809 .name = extra.data.name,
3810 .fqn = extra.data.fqn,
3803 .name_nav = extra.data.name_nav,3811 .name_nav = extra.data.name_nav,
3804 .namespace = extra.data.namespace,3812 .namespace = extra.data.namespace,
3805 .layout = .@"packed",3813 .layout = .@"packed",
...@@ -3880,6 +3888,7 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType {...@@ -3880,6 +3888,7 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType {
3880 .is_reified = extra.data.bits.captures_len == .reified,3888 .is_reified = extra.data.bits.captures_len == .reified,
3881 .owner_union = owner_union,3889 .owner_union = owner_union,
3882 .name = extra.data.name,3890 .name = extra.data.name,
3891 .fqn = extra.data.fqn,
3883 .name_nav = extra.data.name_nav,3892 .name_nav = extra.data.name_nav,
3884 .namespace = extra.data.namespace,3893 .namespace = extra.data.namespace,
3885 .int_tag_type = extra.data.int_tag_type,3894 .int_tag_type = extra.data.int_tag_type,
...@@ -3906,6 +3915,7 @@ pub fn loadOpaqueType(ip: *const InternPool, index: Index) LoadedOpaqueType {...@@ -3906,6 +3915,7 @@ pub fn loadOpaqueType(ip: *const InternPool, index: Index) LoadedOpaqueType {
3906 .len = extra.data.captures_len,3915 .len = extra.data.captures_len,
3907 },3916 },
3908 .name = extra.data.name,3917 .name = extra.data.name,
3918 .fqn = extra.data.fqn,
3909 .name_nav = extra.data.name_nav,3919 .name_nav = extra.data.name_nav,
3910 .namespace = extra.data.namespace,3920 .namespace = extra.data.namespace,
3911 };3921 };
...@@ -5538,6 +5548,7 @@ pub const Tag = enum(u8) {...@@ -5538,6 +5548,7 @@ pub const Tag = enum(u8) {
5538 zir_index: TrackedInst.Index,5548 zir_index: TrackedInst.Index,
55395549
5540 name: NullTerminatedString,5550 name: NullTerminatedString,
5551 fqn: NullTerminatedString,
5541 name_nav: Nav.Index.Optional,5552 name_nav: Nav.Index.Optional,
5542 namespace: NamespaceIndex,5553 namespace: NamespaceIndex,
55435554
...@@ -5580,6 +5591,7 @@ pub const Tag = enum(u8) {...@@ -5580,6 +5591,7 @@ pub const Tag = enum(u8) {
5580 bits: Bits,5591 bits: Bits,
55815592
5582 name: NullTerminatedString,5593 name: NullTerminatedString,
5594 fqn: NullTerminatedString,
5583 name_nav: Nav.Index.Optional,5595 name_nav: Nav.Index.Optional,
5584 namespace: NamespaceIndex,5596 namespace: NamespaceIndex,
55855597
...@@ -5614,6 +5626,7 @@ pub const Tag = enum(u8) {...@@ -5614,6 +5626,7 @@ pub const Tag = enum(u8) {
5614 zir_index: TrackedInst.Index,5626 zir_index: TrackedInst.Index,
56155627
5616 name: NullTerminatedString,5628 name: NullTerminatedString,
5629 fqn: NullTerminatedString,
5617 name_nav: Nav.Index.Optional,5630 name_nav: Nav.Index.Optional,
5618 namespace: NamespaceIndex,5631 namespace: NamespaceIndex,
5619 /// The enum that provides the list of field names and values.5632 /// The enum that provides the list of field names and values.
...@@ -5673,6 +5686,7 @@ pub const Tag = enum(u8) {...@@ -5673,6 +5686,7 @@ pub const Tag = enum(u8) {
5673 bits: Bits,5686 bits: Bits,
56745687
5675 name: NullTerminatedString,5688 name: NullTerminatedString,
5689 fqn: NullTerminatedString,
5676 name_nav: Nav.Index.Optional,5690 name_nav: Nav.Index.Optional,
5677 namespace: NamespaceIndex,5691 namespace: NamespaceIndex,
56785692
...@@ -5708,6 +5722,7 @@ pub const Tag = enum(u8) {...@@ -5708,6 +5722,7 @@ pub const Tag = enum(u8) {
5708 bits: Bits,5722 bits: Bits,
57095723
5710 name: NullTerminatedString,5724 name: NullTerminatedString,
5725 fqn: NullTerminatedString,
5711 name_nav: Nav.Index.Optional,5726 name_nav: Nav.Index.Optional,
5712 namespace: NamespaceIndex,5727 namespace: NamespaceIndex,
57135728
...@@ -5735,6 +5750,7 @@ pub const Tag = enum(u8) {...@@ -5735,6 +5750,7 @@ pub const Tag = enum(u8) {
5735 captures_len: u32,5750 captures_len: u32,
57365751
5737 name: NullTerminatedString,5752 name: NullTerminatedString,
5753 fqn: NullTerminatedString,
5738 name_nav: Nav.Index.Optional,5754 name_nav: Nav.Index.Optional,
5739 namespace: NamespaceIndex,5755 namespace: NamespaceIndex,
5740 };5756 };
...@@ -8063,6 +8079,7 @@ pub fn getDeclaredStructType(...@@ -8063,6 +8079,7 @@ pub fn getDeclaredStructType(
8063 .want_layout = false,8079 .want_layout = false,
8064 },8080 },
8065 .name = undefined, // set by `finish`8081 .name = undefined, // set by `finish`
8082 .fqn = undefined, // set by `finish`
8066 .name_nav = undefined, // set by `finish`8083 .name_nav = undefined, // set by `finish`
8067 .namespace = undefined, // set by `finish`8084 .namespace = undefined, // set by `finish`
8068 .backing_int_type = .none,8085 .backing_int_type = .none,
...@@ -8086,6 +8103,7 @@ pub fn getDeclaredStructType(...@@ -8086,6 +8103,7 @@ pub fn getDeclaredStructType(
8086 .index = gop.put(),8103 .index = gop.put(),
8087 .tid = tid,8104 .tid = tid,
8088 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?,8105 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?,
8106 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "fqn").?,
8089 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?,8107 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?,
8090 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?,8108 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?,
8091 .field_names = undefined,8109 .field_names = undefined,
...@@ -8111,6 +8129,7 @@ pub fn getDeclaredStructType(...@@ -8111,6 +8129,7 @@ pub fn getDeclaredStructType(
8111 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{8129 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{
8112 .zir_index = ini.zir_index,8130 .zir_index = ini.zir_index,
8113 .name = undefined, // set by `finish`8131 .name = undefined, // set by `finish`
8132 .fqn = undefined, // set by `finish`
8114 .name_nav = undefined, // set by `finish`8133 .name_nav = undefined, // set by `finish`
8115 .namespace = undefined, // set by `finish`8134 .namespace = undefined, // set by `finish`
8116 .fields_len = ini.fields_len,8135 .fields_len = ini.fields_len,
...@@ -8154,6 +8173,7 @@ pub fn getDeclaredStructType(...@@ -8154,6 +8173,7 @@ pub fn getDeclaredStructType(
8154 .index = gop.put(),8173 .index = gop.put(),
8155 .tid = tid,8174 .tid = tid,
8156 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?,8175 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?,
8176 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "fqn").?,
8157 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?,8177 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?,
8158 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?,8178 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?,
8159 .field_names = undefined,8179 .field_names = undefined,
...@@ -8207,6 +8227,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe...@@ -8207,6 +8227,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe
8207 .want_layout = false,8227 .want_layout = false,
8208 },8228 },
8209 .name = undefined, // set by `finish`8229 .name = undefined, // set by `finish`
8230 .fqn = undefined, // set by `finish`
8210 .name_nav = undefined, // set by `finish`8231 .name_nav = undefined, // set by `finish`
8211 .namespace = undefined, // set by `finish`8232 .namespace = undefined, // set by `finish`
8212 .backing_int_type = ini.packed_backing_int_type,8233 .backing_int_type = ini.packed_backing_int_type,
...@@ -8233,6 +8254,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe...@@ -8233,6 +8254,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe
8233 .index = gop.put(),8254 .index = gop.put(),
8234 .tid = tid,8255 .tid = tid,
8235 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?,8256 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?,
8257 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "fqn").?,
8236 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?,8258 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?,
8237 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?,8259 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?,
8238 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },8260 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },
...@@ -8260,6 +8282,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe...@@ -8260,6 +8282,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe
8260 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{8282 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{
8261 .zir_index = ini.zir_index,8283 .zir_index = ini.zir_index,
8262 .name = undefined, // set by `finish`8284 .name = undefined, // set by `finish`
8285 .fqn = undefined, // set by `finish`
8263 .name_nav = undefined, // set by `finish`8286 .name_nav = undefined, // set by `finish`
8264 .namespace = undefined, // set by `finish`8287 .namespace = undefined, // set by `finish`
8265 .fields_len = ini.fields_len,8288 .fields_len = ini.fields_len,
...@@ -8305,6 +8328,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe...@@ -8305,6 +8328,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe
8305 .index = gop.put(),8328 .index = gop.put(),
8306 .tid = tid,8329 .tid = tid,
8307 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?,8330 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?,
8331 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "fqn").?,
8308 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?,8332 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?,
8309 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?,8333 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?,
8310 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },8334 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },
...@@ -8378,6 +8402,7 @@ pub fn getDeclaredUnionType(...@@ -8378,6 +8402,7 @@ pub fn getDeclaredUnionType(
8378 .want_layout = false,8402 .want_layout = false,
8379 },8403 },
8380 .name = undefined, // set by `finish`8404 .name = undefined, // set by `finish`
8405 .fqn = undefined, // set by `finish`
8381 .name_nav = undefined, // set by `finish`8406 .name_nav = undefined, // set by `finish`
8382 .namespace = undefined, // set by `finish`8407 .namespace = undefined, // set by `finish`
8383 .backing_int_type = .none,8408 .backing_int_type = .none,
...@@ -8397,6 +8422,7 @@ pub fn getDeclaredUnionType(...@@ -8397,6 +8422,7 @@ pub fn getDeclaredUnionType(
8397 .index = gop.put(),8422 .index = gop.put(),
8398 .tid = tid,8423 .tid = tid,
8399 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?,8424 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?,
8425 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "fqn").?,
8400 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?,8426 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?,
8401 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?,8427 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?,
8402 .field_names = undefined,8428 .field_names = undefined,
...@@ -8417,6 +8443,7 @@ pub fn getDeclaredUnionType(...@@ -8417,6 +8443,7 @@ pub fn getDeclaredUnionType(
8417 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{8443 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{
8418 .zir_index = ini.zir_index,8444 .zir_index = ini.zir_index,
8419 .name = undefined, // set by `finish`8445 .name = undefined, // set by `finish`
8446 .fqn = undefined, // set by `finish`
8420 .name_nav = undefined, // set by `finish`8447 .name_nav = undefined, // set by `finish`
8421 .namespace = undefined, // set by `finish`8448 .namespace = undefined, // set by `finish`
8422 .enum_tag_type = .none,8449 .enum_tag_type = .none,
...@@ -8451,6 +8478,7 @@ pub fn getDeclaredUnionType(...@@ -8451,6 +8478,7 @@ pub fn getDeclaredUnionType(
8451 .index = gop.put(),8478 .index = gop.put(),
8452 .tid = tid,8479 .tid = tid,
8453 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?,8480 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?,
8481 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "fqn").?,
8454 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?,8482 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?,
8455 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?,8483 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?,
8456 .field_names = undefined,8484 .field_names = undefined,
...@@ -8501,6 +8529,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per...@@ -8501,6 +8529,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per
8501 .want_layout = false,8529 .want_layout = false,
8502 },8530 },
8503 .name = undefined, // set by `finish`8531 .name = undefined, // set by `finish`
8532 .fqn = undefined, // set by `finish`
8504 .name_nav = undefined, // set by `finish`8533 .name_nav = undefined, // set by `finish`
8505 .namespace = undefined, // set by `finish`8534 .namespace = undefined, // set by `finish`
8506 .backing_int_type = ini.packed_backing_int_type,8535 .backing_int_type = ini.packed_backing_int_type,
...@@ -8523,6 +8552,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per...@@ -8523,6 +8552,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per
8523 .index = gop.put(),8552 .index = gop.put(),
8524 .tid = tid,8553 .tid = tid,
8525 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?,8554 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?,
8555 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "fqn").?,
8526 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?,8556 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?,
8527 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?,8557 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?,
8528 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },8558 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },
...@@ -8543,6 +8573,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per...@@ -8543,6 +8573,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per
8543 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{8573 const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{
8544 .zir_index = ini.zir_index,8574 .zir_index = ini.zir_index,
8545 .name = undefined, // set by `finish`8575 .name = undefined, // set by `finish`
8576 .fqn = undefined, // set by `finish`
8546 .name_nav = undefined, // set by `finish`8577 .name_nav = undefined, // set by `finish`
8547 .namespace = undefined, // set by `finish`8578 .namespace = undefined, // set by `finish`
8548 .enum_tag_type = ini.enum_tag_type,8579 .enum_tag_type = ini.enum_tag_type,
...@@ -8578,6 +8609,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per...@@ -8578,6 +8609,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per
8578 .index = gop.put(),8609 .index = gop.put(),
8579 .tid = tid,8610 .tid = tid,
8580 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?,8611 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?,
8612 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "fqn").?,
8581 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?,8613 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?,
8582 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?,8614 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?,
8583 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },8615 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },
...@@ -8654,6 +8686,7 @@ pub fn getDeclaredEnumType(...@@ -8654,6 +8686,7 @@ pub fn getDeclaredEnumType(
8654 .want_layout = false,8686 .want_layout = false,
8655 },8687 },
8656 .name = undefined, // set by `finish`8688 .name = undefined, // set by `finish`
8689 .fqn = undefined, // set by `finish`
8657 .name_nav = undefined, // set by `finish`8690 .name_nav = undefined, // set by `finish`
8658 .namespace = undefined, // set by `finish`8691 .namespace = undefined, // set by `finish`
8659 .int_tag_type = .none,8692 .int_tag_type = .none,
...@@ -8673,6 +8706,7 @@ pub fn getDeclaredEnumType(...@@ -8673,6 +8706,7 @@ pub fn getDeclaredEnumType(
8673 .index = gop.put(),8706 .index = gop.put(),
8674 .tid = tid,8707 .tid = tid,
8675 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,8708 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,
8709 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?,
8676 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,8710 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,
8677 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,8711 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,
8678 .field_names = undefined,8712 .field_names = undefined,
...@@ -8729,6 +8763,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT...@@ -8729,6 +8763,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT
8729 .want_layout = false,8763 .want_layout = false,
8730 },8764 },
8731 .name = undefined, // set by `finish`8765 .name = undefined, // set by `finish`
8766 .fqn = undefined, // set by `finish`
8732 .name_nav = undefined, // set by `finish`8767 .name_nav = undefined, // set by `finish`
8733 .namespace = undefined, // set by `finish`8768 .namespace = undefined, // set by `finish`
8734 .int_tag_type = ini.int_tag_type,8769 .int_tag_type = ini.int_tag_type,
...@@ -8750,6 +8785,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT...@@ -8750,6 +8785,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT
8750 .index = gop.put(),8785 .index = gop.put(),
8751 .tid = tid,8786 .tid = tid,
8752 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,8787 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,
8788 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?,
8753 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,8789 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,
8754 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,8790 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,
8755 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },8791 .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len },
...@@ -8828,6 +8864,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu...@@ -8828,6 +8864,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu
8828 .want_layout = false,8864 .want_layout = false,
8829 },8865 },
8830 .name = undefined, // set by `finish`8866 .name = undefined, // set by `finish`
8867 .fqn = undefined, // set by `finish`
8831 .name_nav = undefined, // set by `finish`8868 .name_nav = undefined, // set by `finish`
8832 .namespace = undefined, // set by `finish`8869 .namespace = undefined, // set by `finish`
8833 .int_tag_type = .none,8870 .int_tag_type = .none,
...@@ -8849,6 +8886,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu...@@ -8849,6 +8886,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu
8849 .index = gop.put(),8886 .index = gop.put(),
8850 .tid = tid,8887 .tid = tid,
8851 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,8888 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?,
8889 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?,
8852 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,8890 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?,
8853 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,8891 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?,
8854 .field_names = undefined,8892 .field_names = undefined,
...@@ -8880,6 +8918,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P...@@ -8880,6 +8918,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P
8880 .zir_index = ini.zir_index,8918 .zir_index = ini.zir_index,
8881 .captures_len = @intCast(ini.captures.len),8919 .captures_len = @intCast(ini.captures.len),
8882 .name = undefined, // set by `finish`8920 .name = undefined, // set by `finish`
8921 .fqn = undefined, // set by `finish`
8883 .name_nav = undefined, // set by `finish`8922 .name_nav = undefined, // set by `finish`
8884 .namespace = undefined, // set by `finish`8923 .namespace = undefined, // set by `finish`
8885 });8924 });
...@@ -8892,6 +8931,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P...@@ -8892,6 +8931,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P
8892 .index = gop.put(),8931 .index = gop.put(),
8893 .tid = tid,8932 .tid = tid,
8894 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name").?,8933 .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name").?,
8934 .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "fqn").?,
8895 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name_nav").?,8935 .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name_nav").?,
8896 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "namespace").?,8936 .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "namespace").?,
8897 .field_names = undefined,8937 .field_names = undefined,
...@@ -8906,6 +8946,7 @@ pub const WipContainerType = struct {...@@ -8906,6 +8946,7 @@ pub const WipContainerType = struct {
8906 index: Index,8946 index: Index,
8907 tid: Zcu.PerThread.Id,8947 tid: Zcu.PerThread.Id,
8908 type_name_index: u32,8948 type_name_index: u32,
8949 type_fqn_index: u32,
8909 name_nav_index: u32,8950 name_nav_index: u32,
8910 namespace_index: u32,8951 namespace_index: u32,
89118952
...@@ -8923,6 +8964,7 @@ pub const WipContainerType = struct {...@@ -8923,6 +8964,7 @@ pub const WipContainerType = struct {
8923 wip: WipContainerType,8964 wip: WipContainerType,
8924 ip: *InternPool,8965 ip: *InternPool,
8925 type_name: NullTerminatedString,8966 type_name: NullTerminatedString,
8967 type_fqn: NullTerminatedString,
8926 /// This should be the `Nav` we are named after if we use the `.parent` name strategy; `.none` otherwise.8968 /// This should be the `Nav` we are named after if we use the `.parent` name strategy; `.none` otherwise.
8927 /// This is also `.none` if we use `.parent` because we are the root struct type for a file.8969 /// This is also `.none` if we use `.parent` because we are the root struct type for a file.
8928 name_nav: Nav.Index.Optional,8970 name_nav: Nav.Index.Optional,
...@@ -8930,6 +8972,7 @@ pub const WipContainerType = struct {...@@ -8930,6 +8972,7 @@ pub const WipContainerType = struct {
8930 const extra = ip.getLocalShared(wip.tid).extra.acquire();8972 const extra = ip.getLocalShared(wip.tid).extra.acquire();
8931 const extra_items = extra.view().items(.@"0");8973 const extra_items = extra.view().items(.@"0");
8932 extra_items[wip.type_name_index] = @backingInt(type_name);8974 extra_items[wip.type_name_index] = @backingInt(type_name);
8975 extra_items[wip.type_fqn_index] = @backingInt(type_fqn);
8933 extra_items[wip.name_nav_index] = @backingInt(name_nav);8976 extra_items[wip.name_nav_index] = @backingInt(name_nav);
8934 }8977 }
89358978
src/Sema.zig+37-11
...@@ -403,6 +403,7 @@ pub const Block = struct {...@@ -403,6 +403,7 @@ pub const Block = struct {
403 /// is always incorporated into the type name somehow.403 /// is always incorporated into the type name somehow.
404 /// See `Sema.setTypeName`.404 /// See `Sema.setTypeName`.
405 type_name_ctx: InternPool.NullTerminatedString,405 type_name_ctx: InternPool.NullTerminatedString,
406 type_fqn_ctx: InternPool.NullTerminatedString,
406407
407 /// Create a `LazySrcLoc` based on an `Offset` from the code being analyzed in this block.408 /// Create a `LazySrcLoc` based on an `Offset` from the code being analyzed in this block.
408 /// Specifically, the given `Offset` is treated as relative to `block.src_base_inst`.409 /// Specifically, the given `Offset` is treated as relative to `block.src_base_inst`.
...@@ -531,6 +532,7 @@ pub const Block = struct {...@@ -531,6 +532,7 @@ pub const Block = struct {
531 .need_debug_scope = parent.need_debug_scope,532 .need_debug_scope = parent.need_debug_scope,
532 .src_base_inst = parent.src_base_inst,533 .src_base_inst = parent.src_base_inst,
533 .type_name_ctx = parent.type_name_ctx,534 .type_name_ctx = parent.type_name_ctx,
535 .type_fqn_ctx = parent.type_fqn_ctx,
534 };536 };
535 }537 }
536538
...@@ -4782,7 +4784,7 @@ fn failWithBadStructFieldAccess(...@@ -4782,7 +4784,7 @@ fn failWithBadStructFieldAccess(
4782 const msg = try sema.errMsg(4784 const msg = try sema.errMsg(
4783 field_src,4785 field_src,
4784 "no field named '{f}' in struct '{f}'",4786 "no field named '{f}' in struct '{f}'",
4785 .{ field_name.fmt(ip), struct_type.name.fmt(ip) },4787 .{ field_name.fmt(ip), struct_type.fqn.fmt(ip) },
4786 );4788 );
4787 errdefer msg.destroy(sema.gpa);4789 errdefer msg.destroy(sema.gpa);
4788 try sema.errNote(struct_ty.srcLoc(zcu), msg, "struct declared here", .{});4790 try sema.errNote(struct_ty.srcLoc(zcu), msg, "struct declared here", .{});
...@@ -4808,7 +4810,7 @@ fn failWithBadUnionFieldAccess(...@@ -4808,7 +4810,7 @@ fn failWithBadUnionFieldAccess(
4808 const msg = try sema.errMsg(4810 const msg = try sema.errMsg(
4809 field_src,4811 field_src,
4810 "no field named '{f}' in union '{f}'",4812 "no field named '{f}' in union '{f}'",
4811 .{ field_name.fmt(ip), union_obj.name.fmt(ip) },4813 .{ field_name.fmt(ip), union_obj.fqn.fmt(ip) },
4812 );4814 );
4813 errdefer msg.destroy(gpa);4815 errdefer msg.destroy(gpa);
4814 try sema.errNote(union_ty.srcLoc(zcu), msg, "union declared here", .{});4816 try sema.errNote(union_ty.srcLoc(zcu), msg, "union declared here", .{});
...@@ -5291,6 +5293,7 @@ fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErro...@@ -5291,6 +5293,7 @@ fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErro
5291 .error_return_trace_index = parent_block.error_return_trace_index,5293 .error_return_trace_index = parent_block.error_return_trace_index,
5292 .src_base_inst = parent_block.src_base_inst,5294 .src_base_inst = parent_block.src_base_inst,
5293 .type_name_ctx = parent_block.type_name_ctx,5295 .type_name_ctx = parent_block.type_name_ctx,
5296 .type_fqn_ctx = parent_block.type_fqn_ctx,
5294 };5297 };
52955298
5296 defer child_block.instructions.deinit(gpa);5299 defer child_block.instructions.deinit(gpa);
...@@ -6773,7 +6776,8 @@ fn analyzeCall(...@@ -6773,7 +6776,8 @@ fn analyzeCall(
6773 .instructions = .empty,6776 .instructions = .empty,
6774 .inlining = &generic_inlining,6777 .inlining = &generic_inlining,
6775 .src_base_inst = fn_nav.analysis.?.zir_index,6778 .src_base_inst = fn_nav.analysis.?.zir_index,
6776 .type_name_ctx = fn_nav.fqn,6779 .type_name_ctx = fn_nav.name,
6780 .type_fqn_ctx = fn_nav.fqn,
6777 } else undefined;6781 } else undefined;
6778 defer if (any_generic_types) generic_block.instructions.deinit(gpa);6782 defer if (any_generic_types) generic_block.instructions.deinit(gpa);
67796783
...@@ -7309,7 +7313,8 @@ fn analyzeCall(...@@ -7309,7 +7313,8 @@ fn analyzeCall(
7309 .runtime_loop = block.runtime_loop,7313 .runtime_loop = block.runtime_loop,
7310 .runtime_index = block.runtime_index,7314 .runtime_index = block.runtime_index,
7311 .src_base_inst = fn_nav.analysis.?.zir_index,7315 .src_base_inst = fn_nav.analysis.?.zir_index,
7312 .type_name_ctx = fn_nav.fqn,7316 .type_name_ctx = fn_nav.name,
7317 .type_fqn_ctx = fn_nav.fqn,
7313 };7318 };
73147319
7315 defer child_block.instructions.deinit(gpa);7320 defer child_block.instructions.deinit(gpa);
...@@ -17315,6 +17320,7 @@ fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr...@@ -17315,6 +17320,7 @@ fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
17315 .error_return_trace_index = block.error_return_trace_index,17320 .error_return_trace_index = block.error_return_trace_index,
17316 .src_base_inst = block.src_base_inst,17321 .src_base_inst = block.src_base_inst,
17317 .type_name_ctx = block.type_name_ctx,17322 .type_name_ctx = block.type_name_ctx,
17323 .type_fqn_ctx = block.type_fqn_ctx,
17318 };17324 };
17319 defer child_block.instructions.deinit(sema.gpa);17325 defer child_block.instructions.deinit(sema.gpa);
1732017326
...@@ -17381,6 +17387,7 @@ fn zirTypeofPeer(...@@ -17381,6 +17387,7 @@ fn zirTypeofPeer(
17381 .runtime_index = block.runtime_index,17387 .runtime_index = block.runtime_index,
17382 .src_base_inst = block.src_base_inst,17388 .src_base_inst = block.src_base_inst,
17383 .type_name_ctx = block.type_name_ctx,17389 .type_name_ctx = block.type_name_ctx,
17390 .type_fqn_ctx = block.type_fqn_ctx,
17384 };17391 };
17385 defer child_block.instructions.deinit(sema.gpa);17392 defer child_block.instructions.deinit(sema.gpa);
17386 // Ignore the result, we only care about the instructions in `args`.17393 // Ignore the result, we only care about the instructions in `args`.
...@@ -17940,6 +17947,7 @@ fn ensurePostHoc(sema: *Sema, block: *Block, dest_block: Zir.Inst.Index) !*Label...@@ -17940,6 +17947,7 @@ fn ensurePostHoc(sema: *Sema, block: *Block, dest_block: Zir.Inst.Index) !*Label
17940 .comptime_reason = block.comptime_reason,17947 .comptime_reason = block.comptime_reason,
17941 .src_base_inst = block.src_base_inst,17948 .src_base_inst = block.src_base_inst,
17942 .type_name_ctx = block.type_name_ctx,17949 .type_name_ctx = block.type_name_ctx,
17950 .type_fqn_ctx = block.type_fqn_ctx,
17943 },17951 },
17944 };17952 };
17945 sema.post_hoc_blocks.putAssumeCapacityNoClobber(new_block_inst, labeled_block);17953 sema.post_hoc_blocks.putAssumeCapacityNoClobber(new_block_inst, labeled_block);
...@@ -25935,6 +25943,7 @@ fn addSafetyCheck(...@@ -25935,6 +25943,7 @@ fn addSafetyCheck(
25935 .comptime_reason = null,25943 .comptime_reason = null,
25936 .src_base_inst = parent_block.src_base_inst,25944 .src_base_inst = parent_block.src_base_inst,
25937 .type_name_ctx = parent_block.type_name_ctx,25945 .type_name_ctx = parent_block.type_name_ctx,
25946 .type_fqn_ctx = parent_block.type_fqn_ctx,
25938 };25947 };
2593925948
25940 defer fail_block.instructions.deinit(gpa);25949 defer fail_block.instructions.deinit(gpa);
...@@ -26029,6 +26038,7 @@ fn addSafetyCheckUnwrapError(...@@ -26029,6 +26038,7 @@ fn addSafetyCheckUnwrapError(
26029 .comptime_reason = null,26038 .comptime_reason = null,
26030 .src_base_inst = parent_block.src_base_inst,26039 .src_base_inst = parent_block.src_base_inst,
26031 .type_name_ctx = parent_block.type_name_ctx,26040 .type_name_ctx = parent_block.type_name_ctx,
26041 .type_fqn_ctx = parent_block.type_fqn_ctx,
26032 };26042 };
2603326043
26034 defer fail_block.instructions.deinit(gpa);26044 defer fail_block.instructions.deinit(gpa);
...@@ -26152,6 +26162,7 @@ fn addSafetyCheckCall(...@@ -26152,6 +26162,7 @@ fn addSafetyCheckCall(
26152 .comptime_reason = null,26162 .comptime_reason = null,
26153 .src_base_inst = parent_block.src_base_inst,26163 .src_base_inst = parent_block.src_base_inst,
26154 .type_name_ctx = parent_block.type_name_ctx,26164 .type_name_ctx = parent_block.type_name_ctx,
26165 .type_fqn_ctx = parent_block.type_fqn_ctx,
26155 };26166 };
2615626167
26157 defer fail_block.instructions.deinit(gpa);26168 defer fail_block.instructions.deinit(gpa);
...@@ -34994,6 +35005,7 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C...@@ -34994,6 +35005,7 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C
34994 .comptime_reason = null,35005 .comptime_reason = null,
34995 .src_base_inst = std_type.typeDeclInst(zcu).?,35006 .src_base_inst = std_type.typeDeclInst(zcu).?,
34996 .type_name_ctx = .empty,35007 .type_name_ctx = .empty,
35008 .type_fqn_ctx = .empty,
34997 };35009 };
34998 };35010 };
34999 defer block.instructions.deinit(gpa);35011 defer block.instructions.deinit(gpa);
...@@ -35225,10 +35237,17 @@ pub fn setTypeName(...@@ -35225,10 +35237,17 @@ pub fn setTypeName(
35225 "{f}__{s}_{d}",35237 "{f}__{s}_{d}",
35226 .{ block.type_name_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter },35238 .{ block.type_name_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter },
35227 .no_embedded_nulls,35239 .no_embedded_nulls,
35240 ), try ip.getOrPutStringFmt(
35241 gpa,
35242 io,
35243 pt.tid,
35244 "{f}__{s}_{d}",
35245 .{ block.type_fqn_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter },
35246 .no_embedded_nulls,
35228 ), .none);35247 ), .none);
35229 zcu.anon_name_counter += 1;35248 zcu.anon_name_counter += 1;
35230 },35249 },
35231 .parent => wip.setName(ip, block.type_name_ctx, sema.owner.unwrap().nav_val.toOptional()),35250 .parent => wip.setName(ip, block.type_name_ctx, block.type_fqn_ctx, sema.owner.unwrap().nav_val.toOptional()),
35232 .func => {35251 .func => {
35233 const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse {35252 const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse {
35234 return sema.failTransitive(.{ .lost_tracking = ip.funcZirBodyInst(sema.func_index) });35253 return sema.failTransitive(.{ .lost_tracking = ip.funcZirBodyInst(sema.func_index) });
...@@ -35238,7 +35257,7 @@ pub fn setTypeName(...@@ -35238,7 +35257,7 @@ pub fn setTypeName(
35238 var aw: std.Io.Writer.Allocating = .init(gpa);35257 var aw: std.Io.Writer.Allocating = .init(gpa);
35239 defer aw.deinit();35258 defer aw.deinit();
35240 const w = &aw.writer;35259 const w = &aw.writer;
35241 w.print("{f}(", .{block.type_name_ctx.fmt(ip)}) catch return error.OutOfMemory;35260 w.writeByte('(') catch return error.OutOfMemory;
3524235261
35243 var arg_i: usize = 0;35262 var arg_i: usize = 0;
35244 for (fn_info.param_body) |zir_inst| switch (zir_tags[@backingInt(zir_inst)]) {35263 for (fn_info.param_body) |zir_inst| switch (zir_tags[@backingInt(zir_inst)]) {
...@@ -35273,8 +35292,13 @@ pub fn setTypeName(...@@ -35273,8 +35292,13 @@ pub fn setTypeName(
35273 };35292 };
3527435293
35275 w.writeByte(')') catch return error.OutOfMemory;35294 w.writeByte(')') catch return error.OutOfMemory;
35276 const name = try ip.getOrPutString(gpa, io, pt.tid, aw.written(), .no_embedded_nulls);35295 wip.setName(ip, try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}{s}", .{
35277 wip.setName(ip, name, .none);35296 block.type_name_ctx.fmt(ip),
35297 aw.written(),
35298 }, .no_embedded_nulls), try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}{s}", .{
35299 block.type_fqn_ctx.fmt(ip),
35300 aw.written(),
35301 }, .no_embedded_nulls), .none);
35278 },35302 },
35279 .dbg_var => {35303 .dbg_var => {
35280 // TODO: this logic is questionable. We ideally should be traversing the `Block` rather than relying on the order of AstGen instructions.35304 // TODO: this logic is questionable. We ideally should be traversing the `Block` rather than relying on the order of AstGen instructions.
...@@ -35289,10 +35313,12 @@ pub fn setTypeName(...@@ -35289,10 +35313,12 @@ pub fn setTypeName(
35289 } else {35313 } else {
35290 continue :strat .anon;35314 continue :strat .anon;
35291 };35315 };
35292 const name = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{35316 wip.setName(ip, try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{
35317 // this "{f}." should be elided, but there's currently no way to get the parent function
35293 block.type_name_ctx.fmt(ip), var_name,35318 block.type_name_ctx.fmt(ip), var_name,
35294 }, .no_embedded_nulls);35319 }, .no_embedded_nulls), try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{
35295 wip.setName(ip, name, .none);35320 block.type_fqn_ctx.fmt(ip), var_name,
35321 }, .no_embedded_nulls), .none);
35296 },35322 },
35297 }35323 }
35298}35324}
src/Sema/type_resolution.zig+15-4
...@@ -187,7 +187,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void {...@@ -187,7 +187,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void {
187187
188 const tracy = trace(@src());188 const tracy = trace(@src());
189 defer tracy.end();189 defer tracy.end();
190 tracy.addText(struct_ty.containerTypeName(ip).toSlice(ip));190 tracy.addText(struct_ty.containerTypeName(ip).fqn.toSlice(ip));
191 tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()});191 tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()});
192192
193 assert(sema.owner.unwrap().type_layout == struct_ty.toIntern());193 assert(sema.owner.unwrap().type_layout == struct_ty.toIntern());
...@@ -207,6 +207,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void {...@@ -207,6 +207,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void {
207 .comptime_reason = undefined, // always set before using `block`207 .comptime_reason = undefined, // always set before using `block`
208 .src_base_inst = struct_obj.zir_index,208 .src_base_inst = struct_obj.zir_index,
209 .type_name_ctx = struct_obj.name,209 .type_name_ctx = struct_obj.name,
210 .type_fqn_ctx = struct_obj.fqn,
210 };211 };
211 defer block.instructions.deinit(gpa);212 defer block.instructions.deinit(gpa);
212213
...@@ -613,7 +614,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void {...@@ -613,7 +614,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void {
613614
614 const tracy = trace(@src());615 const tracy = trace(@src());
615 defer tracy.end();616 defer tracy.end();
616 tracy.addText(struct_ty.containerTypeName(ip).toSlice(ip));617 tracy.addText(struct_ty.containerTypeName(ip).fqn.toSlice(ip));
617 tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()});618 tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()});
618619
619 assert(sema.owner.unwrap().struct_defaults == struct_ty.toIntern());620 assert(sema.owner.unwrap().struct_defaults == struct_ty.toIntern());
...@@ -653,6 +654,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void {...@@ -653,6 +654,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void {
653 .comptime_reason = undefined, // always set before using `block`654 .comptime_reason = undefined, // always set before using `block`
654 .src_base_inst = struct_obj.zir_index,655 .src_base_inst = struct_obj.zir_index,
655 .type_name_ctx = struct_obj.name,656 .type_name_ctx = struct_obj.name,
657 .type_fqn_ctx = struct_obj.fqn,
656 };658 };
657 defer block.instructions.deinit(gpa);659 defer block.instructions.deinit(gpa);
658660
...@@ -727,7 +729,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {...@@ -727,7 +729,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {
727729
728 const tracy = trace(@src());730 const tracy = trace(@src());
729 defer tracy.end();731 defer tracy.end();
730 tracy.addText(union_ty.containerTypeName(ip).toSlice(ip));732 tracy.addText(union_ty.containerTypeName(ip).fqn.toSlice(ip));
731 tracy.addTextFmt("ip_index={d}", .{union_ty.toIntern()});733 tracy.addTextFmt("ip_index={d}", .{union_ty.toIntern()});
732734
733 assert(sema.owner.unwrap().type_layout == union_ty.toIntern());735 assert(sema.owner.unwrap().type_layout == union_ty.toIntern());
...@@ -747,6 +749,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {...@@ -747,6 +749,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {
747 .comptime_reason = undefined, // always set before using `block`749 .comptime_reason = undefined, // always set before using `block`
748 .src_base_inst = union_obj.zir_index,750 .src_base_inst = union_obj.zir_index,
749 .type_name_ctx = union_obj.name,751 .type_name_ctx = union_obj.name,
752 .type_fqn_ctx = union_obj.fqn,
750 };753 };
751 defer block.instructions.deinit(gpa);754 defer block.instructions.deinit(gpa);
752755
...@@ -801,6 +804,13 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {...@@ -801,6 +804,13 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void {
801 "@typeInfo({f}).@\"union\".tag_type.?",804 "@typeInfo({f}).@\"union\".tag_type.?",
802 .{union_obj.name.fmt(ip)},805 .{union_obj.name.fmt(ip)},
803 .no_embedded_nulls,806 .no_embedded_nulls,
807 ), try ip.getOrPutStringFmt(
808 gpa,
809 io,
810 pt.tid,
811 "@typeInfo({f}).@\"union\".tag_type.?",
812 .{union_obj.fqn.fmt(ip)},
813 .no_embedded_nulls,
804 ), .none);814 ), .none);
805 const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{815 const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
806 .parent = union_obj.namespace.toOptional(),816 .parent = union_obj.namespace.toOptional(),
...@@ -1221,7 +1231,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void {...@@ -1221,7 +1231,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void {
12211231
1222 const tracy = trace(@src());1232 const tracy = trace(@src());
1223 defer tracy.end();1233 defer tracy.end();
1224 tracy.addText(enum_ty.containerTypeName(ip).toSlice(ip));1234 tracy.addText(enum_ty.containerTypeName(ip).fqn.toSlice(ip));
1225 tracy.addTextFmt("ip_index={d}", .{enum_ty.toIntern()});1235 tracy.addTextFmt("ip_index={d}", .{enum_ty.toIntern()});
12261236
1227 assert(sema.owner.unwrap().type_layout == enum_ty.toIntern());1237 assert(sema.owner.unwrap().type_layout == enum_ty.toIntern());
...@@ -1248,6 +1258,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void {...@@ -1248,6 +1258,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void {
1248 .comptime_reason = undefined, // always set before using `block`1258 .comptime_reason = undefined, // always set before using `block`
1249 .src_base_inst = tracked_inst,1259 .src_base_inst = tracked_inst,
1250 .type_name_ctx = enum_obj.name,1260 .type_name_ctx = enum_obj.name,
1261 .type_fqn_ctx = enum_obj.fqn,
1251 };1262 };
1252 defer block.instructions.deinit(gpa);1263 defer block.instructions.deinit(gpa);
12531264
src/Type.zig+30-15
...@@ -607,8 +607,8 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari...@@ -607,8 +607,8 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari
607 .generic_poison => unreachable,607 .generic_poison => unreachable,
608 },608 },
609 .struct_type => {609 .struct_type => {
610 const name = ip.loadStructType(ty.toIntern()).name;610 const fqn = ip.loadStructType(ty.toIntern()).fqn;
611 try writer.print("{f}", .{name.fmt(ip)});611 try writer.print("{f}", .{fqn.fmt(ip)});
612 },612 },
613 .tuple_type => |tuple| {613 .tuple_type => |tuple| {
614 if (tuple.types.len == 0) {614 if (tuple.types.len == 0) {
...@@ -625,16 +625,16 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari...@@ -625,16 +625,16 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari
625 },625 },
626626
627 .union_type => {627 .union_type => {
628 const name = ip.loadUnionType(ty.toIntern()).name;628 const fqn = ip.loadUnionType(ty.toIntern()).fqn;
629 try writer.print("{f}", .{name.fmt(ip)});629 try writer.print("{f}", .{fqn.fmt(ip)});
630 },630 },
631 .opaque_type => {631 .opaque_type => {
632 const name = ip.loadOpaqueType(ty.toIntern()).name;632 const fqn = ip.loadOpaqueType(ty.toIntern()).fqn;
633 try writer.print("{f}", .{name.fmt(ip)});633 try writer.print("{f}", .{fqn.fmt(ip)});
634 },634 },
635 .enum_type => {635 .enum_type => {
636 const name = ip.loadEnumType(ty.toIntern()).name;636 const fqn = ip.loadEnumType(ty.toIntern()).fqn;
637 try writer.print("{f}", .{name.fmt(ip)});637 try writer.print("{f}", .{fqn.fmt(ip)});
638 },638 },
639 .spirv_type => {639 .spirv_type => {
640 const info = ip.loadSpirvType(ty.toIntern());640 const info = ip.loadSpirvType(ty.toIntern());
...@@ -3020,14 +3020,29 @@ pub fn fieldPtrType(ptr_ty: Type, field_index: u32, pt: Zcu.PerThread) Allocator...@@ -3020,14 +3020,29 @@ pub fn fieldPtrType(ptr_ty: Type, field_index: u32, pt: Zcu.PerThread) Allocator
3020 return pt.ptrType(field_ptr_info);3020 return pt.ptrType(field_ptr_info);
3021}3021}
30223022
3023pub fn containerTypeName(ty: Type, ip: *const InternPool) InternPool.NullTerminatedString {3023pub fn containerTypeName(ty: Type, ip: *const InternPool) struct {
3024 return switch (ip.indexToKey(ty.toIntern())) {3024 name: InternPool.NullTerminatedString,
3025 .struct_type => ip.loadStructType(ty.toIntern()).name,3025 fqn: InternPool.NullTerminatedString,
3026 .union_type => ip.loadUnionType(ty.toIntern()).name,3026} {
3027 .enum_type => ip.loadEnumType(ty.toIntern()).name,3027 switch (ip.indexToKey(ty.toIntern())) {
3028 .opaque_type => ip.loadOpaqueType(ty.toIntern()).name,3028 .struct_type => {
3029 const loaded_struct = ip.loadStructType(ty.toIntern());
3030 return .{ .name = loaded_struct.name, .fqn = loaded_struct.fqn };
3031 },
3032 .union_type => {
3033 const loaded_union = ip.loadUnionType(ty.toIntern());
3034 return .{ .name = loaded_union.name, .fqn = loaded_union.fqn };
3035 },
3036 .enum_type => {
3037 const loaded_enum = ip.loadEnumType(ty.toIntern());
3038 return .{ .name = loaded_enum.name, .fqn = loaded_enum.fqn };
3039 },
3040 .opaque_type => {
3041 const loaded_opaque = ip.loadOpaqueType(ty.toIntern());
3042 return .{ .name = loaded_opaque.name, .fqn = loaded_opaque.fqn };
3043 },
3029 else => unreachable,3044 else => unreachable,
3030 };3045 }
3031}3046}
30323047
3033pub fn destructurable(ty: Type, zcu: *const Zcu) bool {3048pub fn destructurable(ty: Type, zcu: *const Zcu) bool {
src/Zcu.zig+18-18
...@@ -947,9 +947,9 @@ pub const Namespace = struct {...@@ -947,9 +947,9 @@ pub const Namespace = struct {
947 tid: Zcu.PerThread.Id,947 tid: Zcu.PerThread.Id,
948 name: InternPool.NullTerminatedString,948 name: InternPool.NullTerminatedString,
949 ) !InternPool.NullTerminatedString {949 ) !InternPool.NullTerminatedString {
950 const ns_name = Type.fromInterned(ns.owner_type).containerTypeName(ip);950 const ns_fqn = Type.fromInterned(ns.owner_type).containerTypeName(ip).fqn;
951 if (name == .empty) return ns_name;951 if (name == .empty) return ns_fqn;
952 return ip.getOrPutStringFmt(gpa, io, tid, "{f}.{f}", .{ ns_name.fmt(ip), name.fmt(ip) }, .no_embedded_nulls);952 return ip.getOrPutStringFmt(gpa, io, tid, "{f}.{f}", .{ ns_fqn.fmt(ip), name.fmt(ip) }, .no_embedded_nulls);
953 }953 }
954};954};
955955
...@@ -4237,7 +4237,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4237,7 +4237,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4237 const referencer = types.values()[type_idx];4237 const referencer = types.values()[type_idx];
4238 type_idx += 1;4238 type_idx += 1;
42394239
4240 refs_log.debug("handle type '{f}'", .{Type.fromInterned(ty).containerTypeName(ip).fmt(ip)});4240 refs_log.debug("handle type '{f}'", .{Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip)});
42414241
4242 // Queue any decls within this type which would be automatically analyzed.4242 // Queue any decls within this type which would be automatically analyzed.
4243 // Keep in sync with analysis queueing logic in `Zcu.PerThread.ScanDeclIter.scanDecl`.4243 // Keep in sync with analysis queueing logic in `Zcu.PerThread.ScanDeclIter.scanDecl`.
...@@ -4248,7 +4248,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4248,7 +4248,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4248 const gop = try units.getOrPut(gpa, unit);4248 const gop = try units.getOrPut(gpa, unit);
4249 if (!gop.found_existing) {4249 if (!gop.found_existing) {
4250 refs_log.debug("type '{f}': ref comptime %{}", .{4250 refs_log.debug("type '{f}': ref comptime %{}", .{
4251 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),4251 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
4252 @backingInt(ip.getComptimeUnit(cu).zir_index.resolve(ip) orelse continue),4252 @backingInt(ip.getComptimeUnit(cu).zir_index.resolve(ip) orelse continue),
4253 });4253 });
4254 gop.value_ptr.* = referencer;4254 gop.value_ptr.* = referencer;
...@@ -4282,7 +4282,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4282,7 +4282,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4282 const gop = try units.getOrPut(gpa, .wrap(.{ .nav_val = nav_id }));4282 const gop = try units.getOrPut(gpa, .wrap(.{ .nav_val = nav_id }));
4283 if (!gop.found_existing) {4283 if (!gop.found_existing) {
4284 refs_log.debug("type '{f}': ref test %{}", .{4284 refs_log.debug("type '{f}': ref test %{}", .{
4285 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),4285 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
4286 @backingInt(inst_info.inst),4286 @backingInt(inst_info.inst),
4287 });4287 });
4288 gop.value_ptr.* = referencer;4288 gop.value_ptr.* = referencer;
...@@ -4305,7 +4305,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4305,7 +4305,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4305 const gop = try units.getOrPut(gpa, unit);4305 const gop = try units.getOrPut(gpa, unit);
4306 if (!gop.found_existing) {4306 if (!gop.found_existing) {
4307 refs_log.debug("type '{f}': ref named %{}", .{4307 refs_log.debug("type '{f}': ref named %{}", .{
4308 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),4308 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
4309 @backingInt(inst_info.inst),4309 @backingInt(inst_info.inst),
4310 });4310 });
4311 gop.value_ptr.* = referencer;4311 gop.value_ptr.* = referencer;
...@@ -4322,7 +4322,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4322,7 +4322,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4322 const gop = try units.getOrPut(gpa, unit);4322 const gop = try units.getOrPut(gpa, unit);
4323 if (!gop.found_existing) {4323 if (!gop.found_existing) {
4324 refs_log.debug("type '{f}': ref named %{}", .{4324 refs_log.debug("type '{f}': ref named %{}", .{
4325 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),4325 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
4326 @backingInt(inst_info.inst),4326 @backingInt(inst_info.inst),
4327 });4327 });
4328 gop.value_ptr.* = referencer;4328 gop.value_ptr.* = referencer;
...@@ -4385,7 +4385,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4385,7 +4385,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4385 if (!gop.found_existing) {4385 if (!gop.found_existing) {
4386 refs_log.debug("unit '{f}': ref type '{f}'", .{4386 refs_log.debug("unit '{f}': ref type '{f}'", .{
4387 zcu.fmtAnalUnit(unit),4387 zcu.fmtAnalUnit(unit),
4388 Type.fromInterned(ref.referenced).containerTypeName(ip).fmt(ip),4388 Type.fromInterned(ref.referenced).containerTypeName(ip).fqn.fmt(ip),
4389 });4389 });
4390 gop.value_ptr.* = .{4390 gop.value_ptr.* = .{
4391 .referencer = unit,4391 .referencer = unit,
...@@ -4498,7 +4498,7 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void...@@ -4498,7 +4498,7 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void
4498 }4498 }
4499 },4499 },
4500 .nav_val, .nav_ty => |nav, tag| return writer.print("{t}('{f}' [{}])", .{ tag, ip.getNav(nav).fqn.fmt(ip), @backingInt(nav) }),4500 .nav_val, .nav_ty => |nav, tag| return writer.print("{t}('{f}' [{}])", .{ tag, ip.getNav(nav).fqn.fmt(ip), @backingInt(nav) }),
4501 .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @backingInt(ty) }),4501 .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), @backingInt(ty) }),
4502 .func => |func| {4502 .func => |func| {
4503 const nav = zcu.funcInfo(func).owner_nav;4503 const nav = zcu.funcInfo(func).owner_nav;
4504 return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @backingInt(func) });4504 return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @backingInt(func) });
...@@ -4524,8 +4524,8 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void...@@ -4524,8 +4524,8 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void
4524 return writer.print("{t}('{f}')", .{ tag, fqn.fmt(ip) });4524 return writer.print("{t}('{f}')", .{ tag, fqn.fmt(ip) });
4525 },4525 },
4526 .type_layout, .struct_defaults => |ip_index, tag| {4526 .type_layout, .struct_defaults => |ip_index, tag| {
4527 const name = Type.fromInterned(ip_index).containerTypeName(ip);4527 const fqn = Type.fromInterned(ip_index).containerTypeName(ip).fqn;
4528 return writer.print("{t}('{f}')", .{ tag, name.fmt(ip) });4528 return writer.print("{t}('{f}')", .{ tag, fqn.fmt(ip) });
4529 },4529 },
4530 .func_ies => |ip_index| {4530 .func_ies => |ip_index| {
4531 const fqn = ip.getNav(ip.indexToKey(ip_index).func.owner_nav).fqn;4531 const fqn = ip.getNav(ip.indexToKey(ip_index).func.owner_nav).fqn;
...@@ -5002,7 +5002,7 @@ fn addDependencyLoopErrorLine(...@@ -5002,7 +5002,7 @@ fn addDependencyLoopErrorLine(
5002 }),5002 }),
5003 .struct_defaults => |ty| try eb.printString(5003 .struct_defaults => |ty| try eb.printString(
5004 "default field values of '{f}' depend on themselves for initialization here",5004 "default field values of '{f}' depend on themselves for initialization here",
5005 .{Type.fromInterned(ty).containerTypeName(ip).fmt(ip)},5005 .{Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip)},
5006 ),5006 ),
5007 } else switch (dep_node.unit.unwrap()) {5007 } else switch (dep_node.unit.unwrap()) {
5008 .@"comptime" => unreachable, // cannot be involved in a dependency loop5008 .@"comptime" => unreachable, // cannot be involved in a dependency loop
...@@ -5021,12 +5021,12 @@ fn addDependencyLoopErrorLine(...@@ -5021,12 +5021,12 @@ fn addDependencyLoopErrorLine(
5021 }),5021 }),
5022 .type_layout => |ty| try eb.printString("{f} depends on type '{f}' {s}", .{5022 .type_layout => |ty| try eb.printString("{f} depends on type '{f}' {s}", .{
5023 fmt_source,5023 fmt_source,
5024 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),5024 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
5025 dep_node.reason.type_layout_reason.msg(),5025 dep_node.reason.type_layout_reason.msg(),
5026 }),5026 }),
5027 .struct_defaults => |ty| try eb.printString(5027 .struct_defaults => |ty| try eb.printString(
5028 "{f} uses default field values of '{f}' here",5028 "{f} uses default field values of '{f}' here",
5029 .{ fmt_source, Type.fromInterned(ty).containerTypeName(ip).fmt(ip) },5029 .{ fmt_source, Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip) },
5030 ),5030 ),
5031 };5031 };
50325032
...@@ -5068,10 +5068,10 @@ fn formatDependencyLoopSourceUnit(data: FormatAnalUnit, w: *Io.Writer) Io.Writer...@@ -5068,10 +5068,10 @@ fn formatDependencyLoopSourceUnit(data: FormatAnalUnit, w: *Io.Writer) Io.Writer
5068 else => try w.writeAll("'std.lang' declarations"),5068 else => try w.writeAll("'std.lang' declarations"),
5069 },5069 },
5070 .type_layout => |ty| try w.print("type '{f}'", .{5070 .type_layout => |ty| try w.print("type '{f}'", .{
5071 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),5071 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
5072 }),5072 }),
5073 .struct_defaults => |ty| try w.print("default field value of '{f}'", .{5073 .struct_defaults => |ty| try w.print("default field value of '{f}'", .{
5074 Type.fromInterned(ty).containerTypeName(ip).fmt(ip),5074 Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip),
5075 }),5075 }),
5076 .func => |func| try w.print("function '{f}'", .{5076 .func => |func| try w.print("function '{f}'", .{
5077 ip.getNav(zcu.funcInfo(func).owner_nav).fqn.fmt(ip),5077 ip.getNav(zcu.funcInfo(func).owner_nav).fqn.fmt(ip),
...@@ -5121,7 +5121,7 @@ pub fn populateReferenceTrace(...@@ -5121,7 +5121,7 @@ pub fn populateReferenceTrace(
5121 const root_name: ?[]const u8 = switch (ref.referencer.unwrap()) {5121 const root_name: ?[]const u8 = switch (ref.referencer.unwrap()) {
5122 .@"comptime" => "comptime",5122 .@"comptime" => "comptime",
5123 .nav_val, .nav_ty => |nav| ip.getNav(nav).name.toSlice(ip),5123 .nav_val, .nav_ty => |nav| ip.getNav(nav).name.toSlice(ip),
5124 .type_layout, .struct_defaults => |ty| Type.fromInterned(ty).containerTypeName(ip).toSlice(ip),5124 .type_layout, .struct_defaults => |ty| Type.fromInterned(ty).containerTypeName(ip).fqn.toSlice(ip),
5125 .func => |f| ip.getNav(zcu.funcInfo(f).owner_nav).name.toSlice(ip),5125 .func => |f| ip.getNav(zcu.funcInfo(f).owner_nav).name.toSlice(ip),
5126 .memoized_state => null,5126 .memoized_state => null,
5127 };5127 };
src/Zcu/PerThread.zig+21-9
...@@ -1026,7 +1026,12 @@ pub fn ensureFilePopulated(pt: Zcu.PerThread, file_index: Zcu.File.Index) (Alloc...@@ -1026,7 +1026,12 @@ pub fn ensureFilePopulated(pt: Zcu.PerThread, file_index: Zcu.File.Index) (Alloc
1026 };1026 };
1027 errdefer wip.cancel(ip, pt.tid);1027 errdefer wip.cancel(ip, pt.tid);
10281028
1029 wip.setName(ip, try file.internFullyQualifiedName(pt), .none);1029 wip.setName(
1030 ip,
1031 try ip.getOrPutString(gpa, io, pt.tid, std.fs.path.stem(file.sub_file_path), .no_embedded_nulls),
1032 try file.internFullyQualifiedName(pt),
1033 .none,
1034 );
1030 const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{1035 const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{
1031 .parent = .none,1036 .parent = .none,
1032 .owner_type = wip.index,1037 .owner_type = wip.index,
...@@ -1267,6 +1272,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu...@@ -1267,6 +1272,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu
1267 // The comptime unit declares on the source of the corresponding `comptime` declaration.1272 // The comptime unit declares on the source of the corresponding `comptime` declaration.
1268 try sema.declareDependency(.{ .src_hash = comptime_unit.zir_index });1273 try sema.declareDependency(.{ .src_hash = comptime_unit.zir_index });
12691274
1275 const parent_ns = Type.fromInterned(zcu.namespacePtr(comptime_unit.namespace).owner_type).containerTypeName(ip);
1270 var block: Sema.Block = .{1276 var block: Sema.Block = .{
1271 .parent = null,1277 .parent = null,
1272 .sema = &sema,1278 .sema = &sema,
...@@ -1282,7 +1288,10 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu...@@ -1282,7 +1288,10 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu
1282 } },1288 } },
1283 .src_base_inst = comptime_unit.zir_index,1289 .src_base_inst = comptime_unit.zir_index,
1284 .type_name_ctx = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.comptime", .{1290 .type_name_ctx = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.comptime", .{
1285 Type.fromInterned(zcu.namespacePtr(comptime_unit.namespace).owner_type).containerTypeName(ip).fmt(ip),1291 parent_ns.name.fmt(ip),
1292 }, .no_embedded_nulls),
1293 .type_fqn_ctx = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.comptime", .{
1294 parent_ns.fqn.fmt(ip),
1286 }, .no_embedded_nulls),1295 }, .no_embedded_nulls),
1287 };1296 };
1288 defer block.instructions.deinit(gpa);1297 defer block.instructions.deinit(gpa);
...@@ -1358,7 +1367,7 @@ pub fn ensureTypeLayoutUpToDate(...@@ -1358,7 +1367,7 @@ pub fn ensureTypeLayoutUpToDate(
1358 info.deps.clearRetainingCapacity();1367 info.deps.clearRetainingCapacity();
1359 }1368 }
13601369
1361 const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).toSlice(ip), null);1370 const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).fqn.toSlice(ip), null);
1362 defer unit_tracking.end(zcu);1371 defer unit_tracking.end(zcu);
13631372
1364 try zcu.analysis_in_progress.put(gpa, anal_unit, reason);1373 try zcu.analysis_in_progress.put(gpa, anal_unit, reason);
...@@ -1470,7 +1479,7 @@ pub fn ensureStructDefaultsUpToDate(...@@ -1470,7 +1479,7 @@ pub fn ensureStructDefaultsUpToDate(
1470 info.deps.clearRetainingCapacity();1479 info.deps.clearRetainingCapacity();
1471 }1480 }
14721481
1473 const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).toSlice(ip), null);1482 const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).fqn.toSlice(ip), null);
1474 defer unit_tracking.end(zcu);1483 defer unit_tracking.end(zcu);
14751484
1476 try zcu.analysis_in_progress.put(gpa, anal_unit, reason);1485 try zcu.analysis_in_progress.put(gpa, anal_unit, reason);
...@@ -1679,7 +1688,8 @@ fn analyzeNavVal(...@@ -1679,7 +1688,8 @@ fn analyzeNavVal(
1679 .inlining = null,1688 .inlining = null,
1680 .comptime_reason = undefined, // set below1689 .comptime_reason = undefined, // set below
1681 .src_base_inst = old_nav.analysis.?.zir_index,1690 .src_base_inst = old_nav.analysis.?.zir_index,
1682 .type_name_ctx = old_nav.fqn,1691 .type_name_ctx = old_nav.name,
1692 .type_fqn_ctx = old_nav.fqn,
1683 };1693 };
1684 defer block.instructions.deinit(gpa);1694 defer block.instructions.deinit(gpa);
16851695
...@@ -2048,7 +2058,8 @@ fn analyzeNavType(...@@ -2048,7 +2058,8 @@ fn analyzeNavType(
2048 .inlining = null,2058 .inlining = null,
2049 .comptime_reason = undefined, // set below2059 .comptime_reason = undefined, // set below
2050 .src_base_inst = old_nav.analysis.?.zir_index,2060 .src_base_inst = old_nav.analysis.?.zir_index,
2051 .type_name_ctx = old_nav.fqn,2061 .type_name_ctx = old_nav.name,
2062 .type_fqn_ctx = old_nav.fqn,
2052 };2063 };
2053 defer block.instructions.deinit(gpa);2064 defer block.instructions.deinit(gpa);
20542065
...@@ -2989,11 +3000,11 @@ pub fn scanNamespace(...@@ -2989,11 +3000,11 @@ pub fn scanNamespace(
29893000
2990 const tracy_trace = trace(@src());3001 const tracy_trace = trace(@src());
2991 defer tracy_trace.end();3002 defer tracy_trace.end();
2992 tracy_trace.addText(Type.fromInterned(namespace.owner_type).containerTypeName(ip).toSlice(ip));3003 tracy_trace.addText(Type.fromInterned(namespace.owner_type).containerTypeName(ip).fqn.toSlice(ip));
2993 tracy_trace.addTextFmt("type_ip_index={d}", .{namespace.owner_type});3004 tracy_trace.addTextFmt("type_ip_index={d}", .{namespace.owner_type});
29943005
2995 const tracked_unit = zcu.trackUnitSema(3006 const tracked_unit = zcu.trackUnitSema(
2996 Type.fromInterned(namespace.owner_type).containerTypeName(ip).toSlice(ip),3007 Type.fromInterned(namespace.owner_type).containerTypeName(ip).fqn.toSlice(ip),
2997 null,3008 null,
2998 );3009 );
2999 defer tracked_unit.end(zcu);3010 defer tracked_unit.end(zcu);
...@@ -3315,7 +3326,8 @@ fn analyzeFuncBodyInner(...@@ -3315,7 +3326,8 @@ fn analyzeFuncBodyInner(
3315 .inlining = null,3326 .inlining = null,
3316 .comptime_reason = null,3327 .comptime_reason = null,
3317 .src_base_inst = decl_analysis.zir_index,3328 .src_base_inst = decl_analysis.zir_index,
3318 .type_name_ctx = func_nav.fqn,3329 .type_name_ctx = func_nav.name,
3330 .type_fqn_ctx = func_nav.fqn,
3319 };3331 };
3320 defer inner_block.instructions.deinit(gpa);3332 defer inner_block.instructions.deinit(gpa);
33213333
src/codegen/c.zig+3-3
...@@ -2175,11 +2175,11 @@ pub fn genTagNameFn(...@@ -2175,11 +2175,11 @@ pub fn genTagNameFn(
2175 }2175 }
21762176
2177 if (!zcu.comp.config.root_strip) try w.print("/* @tagName({f}) */\n", .{2177 if (!zcu.comp.config.root_strip) try w.print("/* @tagName({f}) */\n", .{
2178 loaded_enum.name.fmt(ip),2178 loaded_enum.fqn.fmt(ip),
2179 });2179 });
2180 try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{2180 try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{
2181 slice_const_u8_sentinel_0_type_name,2181 slice_const_u8_sentinel_0_type_name,
2182 fmtIdentUnsolo(loaded_enum.name.toSlice(ip)),2182 fmtIdentUnsolo(loaded_enum.fqn.toSlice(ip)),
2183 @backingInt(enum_ty.toIntern()),2183 @backingInt(enum_ty.toIntern()),
2184 enum_type_name,2184 enum_type_name,
2185 });2185 });
...@@ -6667,7 +6667,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -6667,7 +6667,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue {
6667 try f.writeCValue(w, local, .other);6667 try f.writeCValue(w, local, .other);
6668 try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {});6668 try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {});
6669 try w.print(" = zig_tagName_{f}__{d}(", .{6669 try w.print(" = zig_tagName_{f}__{d}(", .{
6670 fmtIdentUnsolo(enum_ty.containerTypeName(ip).toSlice(ip)),6670 fmtIdentUnsolo(enum_ty.containerTypeName(ip).fqn.toSlice(ip)),
6671 @backingInt(enum_ty.toIntern()),6671 @backingInt(enum_ty.toIntern()),
6672 });6672 });
6673 try f.writeCValue(w, operand, .other);6673 try f.writeCValue(w, operand, .other);
src/codegen/c/type.zig+3-3
...@@ -1140,17 +1140,17 @@ pub const CType = union(enum) {...@@ -1140,17 +1140,17 @@ pub const CType = union(enum) {
1140 try w.print("_{f}", .{fmtZigType(field_ty, zcu)});1140 try w.print("_{f}", .{fmtZigType(field_ty, zcu)});
1141 }1141 }
1142 } else {1142 } else {
1143 const name = ty.containerTypeName(ip).toSlice(ip);1143 const name = ty.containerTypeName(ip).fqn.toSlice(ip);
1144 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});1144 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});
1145 },1145 },
1146 .@"opaque" => if (ty.toIntern() == .anyopaque_type) {1146 .@"opaque" => if (ty.toIntern() == .anyopaque_type) {
1147 try w.writeAll("anyopaque");1147 try w.writeAll("anyopaque");
1148 } else {1148 } else {
1149 const name = ty.containerTypeName(ip).toSlice(ip);1149 const name = ty.containerTypeName(ip).fqn.toSlice(ip);
1150 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});1150 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});
1151 },1151 },
1152 .@"union", .@"enum" => {1152 .@"union", .@"enum" => {
1153 const name = ty.containerTypeName(ip).toSlice(ip);1153 const name = ty.containerTypeName(ip).fqn.toSlice(ip);
1154 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});1154 try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)});
1155 },1155 },
1156 }1156 }
src/codegen/llvm.zig+5-5
...@@ -2893,7 +2893,7 @@ pub const Object = struct {...@@ -2893,7 +2893,7 @@ pub const Object = struct {
2893 }2893 }
2894 }2894 }
28952895
2896 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip)));2896 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip)));
2897 try o.type_map.put(o.gpa, t.toIntern(), ty);2897 try o.type_map.put(o.gpa, t.toIntern(), ty);
28982898
2899 o.builder.namedTypeSetBody(2899 o.builder.namedTypeSetBody(
...@@ -2983,7 +2983,7 @@ pub const Object = struct {...@@ -2983,7 +2983,7 @@ pub const Object = struct {
2983 };2983 };
29842984
2985 if (layout.tag_size == 0) {2985 if (layout.tag_size == 0) {
2986 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip)));2986 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip)));
2987 try o.type_map.put(o.gpa, t.toIntern(), ty);2987 try o.type_map.put(o.gpa, t.toIntern(), ty);
29882988
2989 o.builder.namedTypeSetBody(2989 o.builder.namedTypeSetBody(
...@@ -3011,7 +3011,7 @@ pub const Object = struct {...@@ -3011,7 +3011,7 @@ pub const Object = struct {
3011 llvm_fields_len += 1;3011 llvm_fields_len += 1;
3012 }3012 }
30133013
3014 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip)));3014 const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip)));
3015 try o.type_map.put(o.gpa, t.toIntern(), ty);3015 try o.type_map.put(o.gpa, t.toIntern(), ty);
30163016
3017 o.builder.namedTypeSetBody(3017 o.builder.namedTypeSetBody(
...@@ -4026,7 +4026,7 @@ pub const Object = struct {...@@ -4026,7 +4026,7 @@ pub const Object = struct {
4026 // Dummy function type; `updateEnumTagNameFunction` will replace it with the correct type.4026 // Dummy function type; `updateEnumTagNameFunction` will replace it with the correct type.
4027 // TODO: change the builder API so we don't need to do this.4027 // TODO: change the builder API so we don't need to do this.
4028 try o.builder.fnType(.void, &.{}, .normal),4028 try o.builder.fnType(.void, &.{}, .normal),
4029 try o.builder.strtabStringFmt("__zig_tag_name_{f}", .{enum_ty.containerTypeName(ip).fmt(ip)}),4029 try o.builder.strtabStringFmt("__zig_tag_name_{f}", .{enum_ty.containerTypeName(ip).fqn.fmt(ip)}),
4030 toLlvmAddressSpace(.generic, zcu.getTarget()),4030 toLlvmAddressSpace(.generic, zcu.getTarget()),
4031 );4031 );
4032 gop.value_ptr.* = llvm_function;4032 gop.value_ptr.* = llvm_function;
...@@ -4123,7 +4123,7 @@ pub const Object = struct {...@@ -4123,7 +4123,7 @@ pub const Object = struct {
4123 // Dummy function type; `updateIsNamedEnumValue` will replace it with the correct type.4123 // Dummy function type; `updateIsNamedEnumValue` will replace it with the correct type.
4124 // TODO: change the builder API so we don't need to do this.4124 // TODO: change the builder API so we don't need to do this.
4125 try o.builder.fnType(.void, &.{}, .normal),4125 try o.builder.fnType(.void, &.{}, .normal),
4126 try o.builder.strtabStringFmt("__zig_is_named_enum_value_{f}", .{enum_ty.containerTypeName(ip).fmt(ip)}),4126 try o.builder.strtabStringFmt("__zig_is_named_enum_value_{f}", .{enum_ty.containerTypeName(ip).fqn.fmt(ip)}),
4127 toLlvmAddressSpace(.generic, zcu.getTarget()),4127 toLlvmAddressSpace(.generic, zcu.getTarget()),
4128 );4128 );
4129 gop.value_ptr.* = llvm_function;4129 gop.value_ptr.* = llvm_function;
src/link.zig+2-2
...@@ -1705,8 +1705,8 @@ pub fn doZcuTask(comp: *Compilation, tid: Zcu.PerThread.Id, task: ZcuTask) void...@@ -1705,8 +1705,8 @@ pub fn doZcuTask(comp: *Compilation, tid: Zcu.PerThread.Id, task: ZcuTask) void
1705 break :nav ip.indexToKey(func).func.owner_nav;1705 break :nav ip.indexToKey(func).func.owner_nav;
1706 },1706 },
1707 .debug_update_container_type => |container_update| nav: {1707 .debug_update_container_type => |container_update| nav: {
1708 const name = Type.fromInterned(container_update.ty).containerTypeName(ip).toSlice(ip);1708 const fqn = Type.fromInterned(container_update.ty).containerTypeName(ip).fqn.toSlice(ip);
1709 const ty_prog_node = comp.link_prog_node.start(name, 0);1709 const ty_prog_node = comp.link_prog_node.start(fqn, 0);
1710 defer ty_prog_node.end();1710 defer ty_prog_node.end();
1711 (if (zcu.llvm_object) |llvm_object|1711 (if (zcu.llvm_object) |llvm_object|
1712 llvm_object.updateContainerType(pt, container_update.ty, container_update.success)1712 llvm_object.updateContainerType(pt, container_update.ty, container_update.success)
src/link/Dwarf.zig+15-15
...@@ -3387,12 +3387,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde...@@ -3387,12 +3387,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde
3387 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file_index);3387 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file_index);
3388 try wip_nav.abbrevCode(.empty_file);3388 try wip_nav.abbrevCode(.empty_file);
3389 try wip_nav.debug_info.writer.writeUleb128(file_gop.index);3389 try wip_nav.debug_info.writer.writeUleb128(file_gop.index);
3390 try wip_nav.strp(loaded_struct.name.toSlice(ip));3390 try wip_nav.strp(loaded_struct.fqn.toSlice(ip));
3391 } else {3391 } else {
3392 try dwarf.emitIncompleteContainerType(3392 try dwarf.emitIncompleteContainerType(
3393 &wip_nav,3393 &wip_nav,
3394 loaded_struct.zir_index,3394 loaded_struct.zir_index,
3395 loaded_struct.name,3395 loaded_struct.fqn,
3396 loaded_struct.name_nav,3396 loaded_struct.name_nav,
3397 );3397 );
3398 }3398 }
...@@ -3402,7 +3402,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde...@@ -3402,7 +3402,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde
3402 try dwarf.emitIncompleteContainerType(3402 try dwarf.emitIncompleteContainerType(
3403 &wip_nav,3403 &wip_nav,
3404 loaded_union.zir_index,3404 loaded_union.zir_index,
3405 loaded_union.name,3405 loaded_union.fqn,
3406 loaded_union.name_nav,3406 loaded_union.name_nav,
3407 );3407 );
3408 },3408 },
...@@ -3412,12 +3412,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde...@@ -3412,12 +3412,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde
3412 try dwarf.emitIncompleteContainerType(3412 try dwarf.emitIncompleteContainerType(
3413 &wip_nav,3413 &wip_nav,
3414 zir_index,3414 zir_index,
3415 loaded_enum.name,3415 loaded_enum.fqn,
3416 loaded_enum.name_nav,3416 loaded_enum.name_nav,
3417 );3417 );
3418 } else {3418 } else {
3419 try wip_nav.abbrevCode(.generated_empty_struct_type);3419 try wip_nav.abbrevCode(.generated_empty_struct_type);
3420 try wip_nav.strp(loaded_enum.name.toSlice(ip));3420 try wip_nav.strp(loaded_enum.fqn.toSlice(ip));
3421 try wip_nav.debug_info.writer.writeByte(@intFromBool(true));3421 try wip_nav.debug_info.writer.writeByte(@intFromBool(true));
3422 }3422 }
3423 },3423 },
...@@ -3426,7 +3426,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde...@@ -3426,7 +3426,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde
3426 try dwarf.emitIncompleteContainerType(3426 try dwarf.emitIncompleteContainerType(
3427 &wip_nav,3427 &wip_nav,
3428 loaded_opaque.zir_index,3428 loaded_opaque.zir_index,
3429 loaded_opaque.name,3429 loaded_opaque.fqn,
3430 loaded_opaque.name_nav,3430 loaded_opaque.name_nav,
3431 );3431 );
3432 },3432 },
...@@ -3451,7 +3451,7 @@ fn emitIncompleteContainerType(...@@ -3451,7 +3451,7 @@ fn emitIncompleteContainerType(
3451 dwarf: *Dwarf,3451 dwarf: *Dwarf,
3452 wip_nav: *WipNav,3452 wip_nav: *WipNav,
3453 zir_index: InternPool.TrackedInst.Index,3453 zir_index: InternPool.TrackedInst.Index,
3454 name: InternPool.NullTerminatedString,3454 fqn: InternPool.NullTerminatedString,
3455 name_nav: InternPool.Nav.Index.Optional,3455 name_nav: InternPool.Nav.Index.Optional,
3456) !void {3456) !void {
3457 const zcu = wip_nav.pt.zcu;3457 const zcu = wip_nav.pt.zcu;
...@@ -3472,7 +3472,7 @@ fn emitIncompleteContainerType(...@@ -3472,7 +3472,7 @@ fn emitIncompleteContainerType(
3472 const file_gop = try dwarf.getModInfo(wip_nav.unit).files.getOrPut(dwarf.gpa, file);3472 const file_gop = try dwarf.getModInfo(wip_nav.unit).files.getOrPut(dwarf.gpa, file);
3473 try wip_nav.abbrevCode(.empty_struct_type);3473 try wip_nav.abbrevCode(.empty_struct_type);
3474 try diw.writeUleb128(file_gop.index);3474 try diw.writeUleb128(file_gop.index);
3475 try wip_nav.strp(name.toSlice(ip));3475 try wip_nav.strp(fqn.toSlice(ip));
3476 try diw.writeByte(@intFromBool(true));3476 try diw.writeByte(@intFromBool(true));
3477 }3477 }
3478}3478}
...@@ -3895,7 +3895,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -3895,7 +3895,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
3895 else => if (struct_is_file) .file else .struct_type,3895 else => if (struct_is_file) .file else .struct_type,
3896 });3896 });
3897 try diw.writeUleb128(file_gop.index);3897 try diw.writeUleb128(file_gop.index);
3898 try wip_nav.strp(loaded_struct.name.toSlice(ip));3898 try wip_nav.strp(loaded_struct.fqn.toSlice(ip));
3899 }3899 }
3900 if (loaded_struct.field_types.len == 0) {3900 if (loaded_struct.field_types.len == 0) {
3901 if (!struct_is_file) try diw.writeByte(@intFromBool(false));3901 if (!struct_is_file) try diw.writeByte(@intFromBool(false));
...@@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
3968 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);3968 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);
3969 try wip_nav.abbrevCode(if (loaded_struct.field_types.len > 0) .packed_struct_type else .empty_packed_struct_type);3969 try wip_nav.abbrevCode(if (loaded_struct.field_types.len > 0) .packed_struct_type else .empty_packed_struct_type);
3970 try diw.writeUleb128(file_gop.index);3970 try diw.writeUleb128(file_gop.index);
3971 try wip_nav.strp(loaded_struct.name.toSlice(ip));3971 try wip_nav.strp(loaded_struct.fqn.toSlice(ip));
3972 break :t loaded_struct.field_types.len > 0;3972 break :t loaded_struct.field_types.len > 0;
3973 };3973 };
3974 try wip_nav.refType(.fromInterned(loaded_struct.packed_backing_int_type));3974 try wip_nav.refType(.fromInterned(loaded_struct.packed_backing_int_type));
...@@ -4005,7 +4005,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4005,7 +4005,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4005 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);4005 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);
4006 try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .union_type else .empty_union_type);4006 try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .union_type else .empty_union_type);
4007 try diw.writeUleb128(file_gop.index);4007 try diw.writeUleb128(file_gop.index);
4008 try wip_nav.strp(loaded_union.name.toSlice(ip));4008 try wip_nav.strp(loaded_union.fqn.toSlice(ip));
4009 break :t loaded_union.field_types.len > 0;4009 break :t loaded_union.field_types.len > 0;
4010 };4010 };
4011 const union_layout = Type.getUnionLayout(loaded_union, zcu);4011 const union_layout = Type.getUnionLayout(loaded_union, zcu);
...@@ -4067,7 +4067,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4067,7 +4067,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4067 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);4067 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);
4068 try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .packed_union_type else .empty_packed_union_type);4068 try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .packed_union_type else .empty_packed_union_type);
4069 try diw.writeUleb128(file_gop.index);4069 try diw.writeUleb128(file_gop.index);
4070 try wip_nav.strp(loaded_union.name.toSlice(ip));4070 try wip_nav.strp(loaded_union.fqn.toSlice(ip));
4071 break :t loaded_union.field_types.len > 0;4071 break :t loaded_union.field_types.len > 0;
4072 };4072 };
4073 try wip_nav.refType(.fromInterned(loaded_union.packed_backing_int_type));4073 try wip_nav.refType(.fromInterned(loaded_union.packed_backing_int_type));
...@@ -4103,7 +4103,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4103,7 +4103,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4103 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);4103 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);
4104 try wip_nav.abbrevCode(if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type);4104 try wip_nav.abbrevCode(if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type);
4105 try diw.writeUleb128(file_gop.index);4105 try diw.writeUleb128(file_gop.index);
4106 try wip_nav.strp(loaded_enum.name.toSlice(ip));4106 try wip_nav.strp(loaded_enum.fqn.toSlice(ip));
4107 }4107 }
4108 try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type));4108 try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type));
4109 for (0..loaded_enum.field_names.len) |field_index| {4109 for (0..loaded_enum.field_names.len) |field_index| {
...@@ -4115,7 +4115,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4115,7 +4115,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4115 } else {4115 } else {
4116 assert(loaded_enum.owner_union != .none);4116 assert(loaded_enum.owner_union != .none);
4117 try wip_nav.abbrevCode(if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type);4117 try wip_nav.abbrevCode(if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type);
4118 try wip_nav.strp(loaded_enum.name.toSlice(ip));4118 try wip_nav.strp(loaded_enum.fqn.toSlice(ip));
4119 try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type));4119 try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type));
4120 for (0..loaded_enum.field_names.len) |field_index| {4120 for (0..loaded_enum.field_names.len) |field_index| {
4121 try wip_nav.abbrevCode(.enum_field);4121 try wip_nav.abbrevCode(.enum_field);
...@@ -4141,7 +4141,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4141,7 +4141,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4141 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);4141 const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file);
4142 try wip_nav.abbrevCode(.empty_struct_type);4142 try wip_nav.abbrevCode(.empty_struct_type);
4143 try diw.writeUleb128(file_gop.index);4143 try diw.writeUleb128(file_gop.index);
4144 try wip_nav.strp(loaded_opaque.name.toSlice(ip));4144 try wip_nav.strp(loaded_opaque.fqn.toSlice(ip));
4145 }4145 }
4146 try diw.writeByte(@intFromBool(true));4146 try diw.writeByte(@intFromBool(true));
4147 },4147 },
src/link/Dwarf2.zig+14-14
...@@ -2349,7 +2349,7 @@ fn updateConstInner(...@@ -2349,7 +2349,7 @@ fn updateConstInner(
2349 else => if (struct_is_file) .file else .struct_type,2349 else => if (struct_is_file) .file else .struct_type,
2350 }));2350 }));
2351 try diw.writeUleb128(@backingInt(fi));2351 try diw.writeUleb128(@backingInt(fi));
2352 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip));2352 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip));
2353 }2353 }
2354 if (loaded_struct.field_types.len > 0) {2354 if (loaded_struct.field_types.len > 0) {
2355 const ty: Type = .fromInterned(val);2355 const ty: Type = .fromInterned(val);
...@@ -2422,14 +2422,14 @@ fn updateConstInner(...@@ -2422,14 +2422,14 @@ fn updateConstInner(
2422 if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type,2422 if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type,
2423 ));2423 ));
2424 try diw.writeUleb128(@backingInt(fi));2424 try diw.writeUleb128(@backingInt(fi));
2425 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip));2425 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip));
2426 }2426 }
2427 } else {2427 } else {
2428 assert(loaded_enum.owner_union != .none);2428 assert(loaded_enum.owner_union != .none);
2429 try diw.writeUleb128(try dwarf.refAbbrevCode(2429 try diw.writeUleb128(try dwarf.refAbbrevCode(
2430 if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type,2430 if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type,
2431 ));2431 ));
2432 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip));2432 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip));
2433 }2433 }
2434 try dwarf.refConst(pt, di_nw, .fromInterned(loaded_enum.int_tag_type));2434 try dwarf.refConst(pt, di_nw, .fromInterned(loaded_enum.int_tag_type));
2435 for (0..loaded_enum.field_names.len) |field_index| {2435 for (0..loaded_enum.field_names.len) |field_index| {
...@@ -2465,7 +2465,7 @@ fn updateConstIncompleteInner(...@@ -2465,7 +2465,7 @@ fn updateConstIncompleteInner(
2465 const ip = &zcu.intern_pool;2465 const ip = &zcu.intern_pool;
2466 const diw = &di_nw.interface;2466 const diw = &di_nw.interface;
2467 done: {2467 done: {
2468 const src_inst, const zf, const capture_names, const captures, const name, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(val)) {2468 const src_inst, const zf, const capture_names, const captures, const fqn, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(val)) {
2469 .struct_type => {2469 .struct_type => {
2470 const loaded_struct = ip.loadStructType(val);2470 const loaded_struct = ip.loadStructType(val);
2471 const src_inst = loaded_struct.zir_index.resolveFull(ip) orelse {2471 const src_inst = loaded_struct.zir_index.resolveFull(ip) orelse {
...@@ -2479,7 +2479,7 @@ fn updateConstIncompleteInner(...@@ -2479,7 +2479,7 @@ fn updateConstIncompleteInner(
2479 _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, src_inst.file);2479 _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, src_inst.file);
2480 try diw.writeUleb128(try dwarf.refAbbrevCode(.empty_file));2480 try diw.writeUleb128(try dwarf.refAbbrevCode(.empty_file));
2481 try diw.writeUleb128(@backingInt(fi));2481 try diw.writeUleb128(@backingInt(fi));
2482 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip));2482 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip));
2483 try diw.writeByte(@intFromBool(true));2483 try diw.writeByte(@intFromBool(true));
2484 break :done;2484 break :done;
2485 },2485 },
...@@ -2488,7 +2488,7 @@ fn updateConstIncompleteInner(...@@ -2488,7 +2488,7 @@ fn updateConstIncompleteInner(
2488 zf,2488 zf,
2489 zf.zir.?.getStructDecl(src_inst.inst).capture_names,2489 zf.zir.?.getStructDecl(src_inst.inst).capture_names,
2490 loaded_struct.captures,2490 loaded_struct.captures,
2491 loaded_struct.name,2491 loaded_struct.fqn,
2492 loaded_struct.name_nav,2492 loaded_struct.name_nav,
2493 loaded_struct.namespace,2493 loaded_struct.namespace,
2494 },2494 },
...@@ -2506,7 +2506,7 @@ fn updateConstIncompleteInner(...@@ -2506,7 +2506,7 @@ fn updateConstIncompleteInner(
2506 zf,2506 zf,
2507 zf.zir.?.getUnionDecl(src_inst.inst).capture_names,2507 zf.zir.?.getUnionDecl(src_inst.inst).capture_names,
2508 loaded_union.captures,2508 loaded_union.captures,
2509 loaded_union.name,2509 loaded_union.fqn,
2510 loaded_union.name_nav,2510 loaded_union.name_nav,
2511 loaded_union.namespace,2511 loaded_union.namespace,
2512 };2512 };
...@@ -2515,7 +2515,7 @@ fn updateConstIncompleteInner(...@@ -2515,7 +2515,7 @@ fn updateConstIncompleteInner(
2515 const loaded_enum = ip.loadEnumType(val);2515 const loaded_enum = ip.loadEnumType(val);
2516 const zir_index = loaded_enum.zir_index.unwrap() orelse {2516 const zir_index = loaded_enum.zir_index.unwrap() orelse {
2517 try diw.writeUleb128(try dwarf.refAbbrevCode(.generated_empty_struct_type));2517 try diw.writeUleb128(try dwarf.refAbbrevCode(.generated_empty_struct_type));
2518 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip));2518 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip));
2519 try diw.writeByte(@intFromBool(true));2519 try diw.writeByte(@intFromBool(true));
2520 break :done;2520 break :done;
2521 };2521 };
...@@ -2529,7 +2529,7 @@ fn updateConstIncompleteInner(...@@ -2529,7 +2529,7 @@ fn updateConstIncompleteInner(
2529 zf,2529 zf,
2530 zf.zir.?.getEnumDecl(src_inst.inst).capture_names,2530 zf.zir.?.getEnumDecl(src_inst.inst).capture_names,
2531 loaded_enum.captures,2531 loaded_enum.captures,
2532 loaded_enum.name,2532 loaded_enum.fqn,
2533 loaded_enum.name_nav,2533 loaded_enum.name_nav,
2534 loaded_enum.namespace,2534 loaded_enum.namespace,
2535 };2535 };
...@@ -2546,7 +2546,7 @@ fn updateConstIncompleteInner(...@@ -2546,7 +2546,7 @@ fn updateConstIncompleteInner(
2546 zf,2546 zf,
2547 zf.zir.?.getOpaqueDecl(src_inst.inst).capture_names,2547 zf.zir.?.getOpaqueDecl(src_inst.inst).capture_names,
2548 loaded_opaque.captures,2548 loaded_opaque.captures,
2549 loaded_opaque.name,2549 loaded_opaque.fqn,
2550 loaded_opaque.name_nav,2550 loaded_opaque.name_nav,
2551 loaded_opaque.namespace,2551 loaded_opaque.namespace,
2552 };2552 };
...@@ -2597,7 +2597,7 @@ fn updateConstIncompleteInner(...@@ -2597,7 +2597,7 @@ fn updateConstIncompleteInner(
2597 if (capturing) .capturing_empty_struct_type else .empty_struct_type,2597 if (capturing) .capturing_empty_struct_type else .empty_struct_type,
2598 ));2598 ));
2599 try diw.writeUleb128(@backingInt(fi));2599 try diw.writeUleb128(@backingInt(fi));
2600 try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip));2600 try dwarf.strp(&dwarf.debug_str, di_nw, fqn.toSlice(ip));
2601 }2601 }
2602 try diw.writeByte(@intFromBool(true));2602 try diw.writeByte(@intFromBool(true));
2603 if (capturing) {2603 if (capturing) {
...@@ -2661,7 +2661,7 @@ fn genDeclInner(...@@ -2661,7 +2661,7 @@ fn genDeclInner(
2661 try diw.writeInt(u32, 0, dwarf.endian);2661 try diw.writeInt(u32, 0, dwarf.endian);
2662 try diw.writeUleb128(0);2662 try diw.writeUleb128(0);
2663 try diw.writeByte(DW.ACCESS.public);2663 try diw.writeByte(DW.ACCESS.public);
2664 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip));2664 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip));
2665 },2665 },
2666 .enum_type => {2666 .enum_type => {
2667 const loaded_enum = ip.loadEnumType(instance_val);2667 const loaded_enum = ip.loadEnumType(instance_val);
...@@ -2673,7 +2673,7 @@ fn genDeclInner(...@@ -2673,7 +2673,7 @@ fn genDeclInner(
2673 try diw.writeInt(u32, 0, dwarf.endian);2673 try diw.writeInt(u32, 0, dwarf.endian);
2674 try diw.writeUleb128(0);2674 try diw.writeUleb128(0);
2675 try diw.writeByte(DW.ACCESS.public);2675 try diw.writeByte(DW.ACCESS.public);
2676 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip));2676 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip));
2677 },2677 },
2678 .union_type => {2678 .union_type => {
2679 const loaded_union = ip.loadUnionType(instance_val);2679 const loaded_union = ip.loadUnionType(instance_val);
...@@ -2685,7 +2685,7 @@ fn genDeclInner(...@@ -2685,7 +2685,7 @@ fn genDeclInner(
2685 try diw.writeInt(u32, 0, dwarf.endian);2685 try diw.writeInt(u32, 0, dwarf.endian);
2686 try diw.writeUleb128(0);2686 try diw.writeUleb128(0);
2687 try diw.writeByte(DW.ACCESS.public);2687 try diw.writeByte(DW.ACCESS.public);
2688 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_union.name.toSlice(ip));2688 try dwarf.strp(&dwarf.debug_str, di_nw, loaded_union.fqn.toSlice(ip));
2689 },2689 },
2690 }2690 }
2691 try dwarf.genDebugInfoPadding(diw, diw.unusedCapacityLen());2691 try dwarf.genDebugInfoPadding(diw, diw.unusedCapacityLen());