authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-23 19:19:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:47:54-07:00
log20522600399fb38e8e220cab0f8f59234725b9f1
treeab6906636359ffbcc8bb8fb094a90e2f1dc2b99b
parent01ca841f1227cc3e17169c45318c8d4757a5c0d2

Sema: update zirSliceLength to avoid resolveInst(.none)


1 files changed, 9 insertions(+), 13 deletions(-)

src/Sema.zig+9-13
......@@ -10088,7 +10088,7 @@ fn zirSliceLength(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
1008810088 const array_ptr = try sema.resolveInst(extra.lhs);
1008910089 const start = try sema.resolveInst(extra.start);
1009010090 const len = try sema.resolveInst(extra.len);
10091 const sentinel = try sema.resolveInst(extra.sentinel);
10091 const sentinel = if (extra.sentinel == .none) .none else try sema.resolveInst(extra.sentinel);
1009210092 const ptr_src: LazySrcLoc = .{ .node_offset_slice_ptr = inst_data.src_node };
1009310093 const start_src: LazySrcLoc = .{ .node_offset_slice_start = extra.start_src_node_offset };
1009410094 const end_src: LazySrcLoc = .{ .node_offset_slice_end = inst_data.src_node };
......@@ -31997,17 +31997,14 @@ pub fn resolveTypeFully(sema: *Sema, ty: Type) CompileError!void {
3199731997 const child_ty = try sema.resolveTypeFields(ty.childType(mod));
3199831998 return sema.resolveTypeFully(child_ty);
3199931999 },
32000 .Struct => switch (ty.ip_index) {
32001 .none => {}, // TODO make this unreachable when all types are migrated to InternPool
32002 else => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
32003 .struct_type => return sema.resolveStructFully(ty),
32004 .anon_struct_type => |tuple| {
32005 for (tuple.types) |field_ty| {
32006 try sema.resolveTypeFully(field_ty.toType());
32007 }
32008 },
32009 else => {},
32000 .Struct => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
32001 .struct_type => return sema.resolveStructFully(ty),
32002 .anon_struct_type => |tuple| {
32003 for (tuple.types) |field_ty| {
32004 try sema.resolveTypeFully(field_ty.toType());
32005 }
3201032006 },
32007 else => {},
3201132008 },
3201232009 .Union => return sema.resolveUnionFully(ty),
3201332010 .Array => return sema.resolveTypeFully(ty.childType(mod)),
......@@ -32096,8 +32093,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type {
3209632093 switch (ty.ip_index) {
3209732094 .var_args_param_type => unreachable,
3209832095
32099 // TODO: After the InternPool transition is complete, change this to `unreachable`.
32100 .none => return ty,
32096 .none => unreachable,
3210132097
3210232098 .u1_type,
3210332099 .u8_type,