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...@@ -10088,7 +10088,7 @@ fn zirSliceLength(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
10088 const array_ptr = try sema.resolveInst(extra.lhs);10088 const array_ptr = try sema.resolveInst(extra.lhs);
10089 const start = try sema.resolveInst(extra.start);10089 const start = try sema.resolveInst(extra.start);
10090 const len = try sema.resolveInst(extra.len);10090 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);
10092 const ptr_src: LazySrcLoc = .{ .node_offset_slice_ptr = inst_data.src_node };10092 const ptr_src: LazySrcLoc = .{ .node_offset_slice_ptr = inst_data.src_node };
10093 const start_src: LazySrcLoc = .{ .node_offset_slice_start = extra.start_src_node_offset };10093 const start_src: LazySrcLoc = .{ .node_offset_slice_start = extra.start_src_node_offset };
10094 const end_src: LazySrcLoc = .{ .node_offset_slice_end = inst_data.src_node };10094 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 {...@@ -31997,17 +31997,14 @@ pub fn resolveTypeFully(sema: *Sema, ty: Type) CompileError!void {
31997 const child_ty = try sema.resolveTypeFields(ty.childType(mod));31997 const child_ty = try sema.resolveTypeFields(ty.childType(mod));
31998 return sema.resolveTypeFully(child_ty);31998 return sema.resolveTypeFully(child_ty);
31999 },31999 },
32000 .Struct => switch (ty.ip_index) {32000 .Struct => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
32001 .none => {}, // TODO make this unreachable when all types are migrated to InternPool32001 .struct_type => return sema.resolveStructFully(ty),
32002 else => switch (mod.intern_pool.indexToKey(ty.ip_index)) {32002 .anon_struct_type => |tuple| {
32003 .struct_type => return sema.resolveStructFully(ty),32003 for (tuple.types) |field_ty| {
32004 .anon_struct_type => |tuple| {32004 try sema.resolveTypeFully(field_ty.toType());
32005 for (tuple.types) |field_ty| {32005 }
32006 try sema.resolveTypeFully(field_ty.toType());
32007 }
32008 },
32009 else => {},
32010 },32006 },
32007 else => {},
32011 },32008 },
32012 .Union => return sema.resolveUnionFully(ty),32009 .Union => return sema.resolveUnionFully(ty),
32013 .Array => return sema.resolveTypeFully(ty.childType(mod)),32010 .Array => return sema.resolveTypeFully(ty.childType(mod)),
...@@ -32096,8 +32093,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type {...@@ -32096,8 +32093,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type {
32096 switch (ty.ip_index) {32093 switch (ty.ip_index) {
32097 .var_args_param_type => unreachable,32094 .var_args_param_type => unreachable,
3209832095
32099 // TODO: After the InternPool transition is complete, change this to `unreachable`.32096 .none => unreachable,
32100 .none => return ty,
3210132097
32102 .u1_type,32098 .u1_type,
32103 .u8_type,32099 .u8_type,