authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2026-06-02 17:20:25+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-07 05:44:13+02:00
logabd649a50c500706c37e8e8859bb4bd6fec2006a
treee8b964d45d729743a7b06e0fea8de961c4051d6c
parent4140c9a2c7f5caa626ba0246d5a0905e45ddb12d

Fix TODO in `Type.eql`


7 files changed, 35 insertions(+), 36 deletions(-)

src/RangeSet.zig+4-4
...@@ -20,8 +20,8 @@ pub fn ensureUnusedCapacity(self: *RangeSet, allocator: Allocator, additional_co...@@ -20,8 +20,8 @@ pub fn ensureUnusedCapacity(self: *RangeSet, allocator: Allocator, additional_co
20}20}
2121
22pub fn addAssumeCapacity(set: *RangeSet, new: Range, ty: Type, zcu: *Zcu) ?LazySrcLoc {22pub fn addAssumeCapacity(set: *RangeSet, new: Range, ty: Type, zcu: *Zcu) ?LazySrcLoc {
23 assert(new.first.typeOf(zcu).eql(ty, zcu));23 assert(new.first.typeOf(zcu).eql(ty));
24 assert(new.last.typeOf(zcu).eql(ty, zcu));24 assert(new.last.typeOf(zcu).eql(ty));
2525
26 for (set.ranges.items) |range| {26 for (set.ranges.items) |range| {
27 if (new.last.compareScalar(.gte, range.first, ty, zcu) and27 if (new.last.compareScalar(.gte, range.first, ty, zcu) and
...@@ -56,8 +56,8 @@ pub fn spans(...@@ -56,8 +56,8 @@ pub fn spans(
56 ty: Type,56 ty: Type,
57 zcu: *Zcu,57 zcu: *Zcu,
58) Allocator.Error!bool {58) Allocator.Error!bool {
59 assert(first.typeOf(zcu).eql(ty, zcu));59 assert(first.typeOf(zcu).eql(ty));
60 assert(last.typeOf(zcu).eql(ty, zcu));60 assert(last.typeOf(zcu).eql(ty));
61 if (set.ranges.items.len == 0) return false;61 if (set.ranges.items.len == 0) return false;
6262
63 std.mem.sort(Range, set.ranges.items, SortCtx{ .ty = ty, .zcu = zcu }, lessThan);63 std.mem.sort(Range, set.ranges.items, SortCtx{ .ty = ty, .zcu = zcu }, lessThan);
src/Sema.zig+19-19
...@@ -5462,7 +5462,7 @@ fn resolveAnalyzedBlock(...@@ -5462,7 +5462,7 @@ fn resolveAnalyzedBlock(
5462 const br_operand = sema.air_instructions.items(.data)[@intFromEnum(br)].br.operand;5462 const br_operand = sema.air_instructions.items(.data)[@intFromEnum(br)].br.operand;
5463 const br_operand_src = src;5463 const br_operand_src = src;
5464 const br_operand_ty = sema.typeOf(br_operand);5464 const br_operand_ty = sema.typeOf(br_operand);
5465 if (br_operand_ty.eql(resolved_ty, zcu)) {5465 if (br_operand_ty.eql(resolved_ty)) {
5466 // No type coercion needed.5466 // No type coercion needed.
5467 continue;5467 continue;
5468 }5468 }
...@@ -12092,7 +12092,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(...@@ -12092,7 +12092,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion(
12092 // PTR! This will also allow us to emit simpler code.12092 // PTR! This will also allow us to emit simpler code.
12093 const same_types = for (field_indices[1..]) |field_idx| {12093 const same_types = for (field_indices[1..]) |field_idx| {
12094 const field_ty: Type = .fromInterned(union_obj.field_types.get(ip)[field_idx]);12094 const field_ty: Type = .fromInterned(union_obj.field_types.get(ip)[field_idx]);
12095 if (!field_ty.eql(first_field_ty, zcu)) break false;12095 if (!field_ty.eql(first_field_ty)) break false;
12096 } else true;12096 } else true;
1209712097
12098 const capture_ty: Type = capture_ty: {12098 const capture_ty: Type = capture_ty: {
...@@ -15301,7 +15301,7 @@ fn zirCmpEq(...@@ -15301,7 +15301,7 @@ fn zirCmpEq(
15301 if (lhs_ty_tag == .type and rhs_ty_tag == .type) {15301 if (lhs_ty_tag == .type and rhs_ty_tag == .type) {
15302 const lhs_as_type = try sema.analyzeAsType(block, lhs_src, .type, lhs);15302 const lhs_as_type = try sema.analyzeAsType(block, lhs_src, .type, lhs);
15303 const rhs_as_type = try sema.analyzeAsType(block, rhs_src, .type, rhs);15303 const rhs_as_type = try sema.analyzeAsType(block, rhs_src, .type, rhs);
15304 return if (lhs_as_type.eql(rhs_as_type, zcu) == (op == .eq)) .bool_true else .bool_false;15304 return if (lhs_as_type.eql(rhs_as_type) == (op == .eq)) .bool_true else .bool_false;
15305 }15305 }
15306 return sema.analyzeCmp(block, src, lhs, rhs, op, lhs_src, rhs_src, true);15306 return sema.analyzeCmp(block, src, lhs, rhs, op, lhs_src, rhs_src, true);
15307}15307}
...@@ -26437,7 +26437,7 @@ fn fieldCallBind(...@@ -26437,7 +26437,7 @@ fn fieldCallBind(
26437 (first_param_type.zigTypeTag(zcu) == .pointer and26437 (first_param_type.zigTypeTag(zcu) == .pointer and
26438 (first_param_type.ptrSize(zcu) == .one or26438 (first_param_type.ptrSize(zcu) == .one or
26439 first_param_type.ptrSize(zcu) == .c) and26439 first_param_type.ptrSize(zcu) == .c) and
26440 first_param_type.childType(zcu).eql(concrete_ty, zcu)))26440 first_param_type.childType(zcu).eql(concrete_ty)))
26441 {26441 {
26442 // Note that if the param type is generic poison, we know that it must26442 // Note that if the param type is generic poison, we know that it must
26443 // specifically be `anytype` since it's the first parameter, meaning we26443 // specifically be `anytype` since it's the first parameter, meaning we
...@@ -26448,7 +26448,7 @@ fn fieldCallBind(...@@ -26448,7 +26448,7 @@ fn fieldCallBind(
26448 .func_inst = decl_val,26448 .func_inst = decl_val,
26449 .arg0_inst = object_ptr,26449 .arg0_inst = object_ptr,
26450 } };26450 } };
26451 } else if (first_param_type.eql(concrete_ty, zcu)) {26451 } else if (first_param_type.eql(concrete_ty)) {
26452 const deref = try sema.analyzeLoad(block, src, object_ptr, src);26452 const deref = try sema.analyzeLoad(block, src, object_ptr, src);
26453 return .{ .method = .{26453 return .{ .method = .{
26454 .func_inst = decl_val,26454 .func_inst = decl_val,
...@@ -26456,7 +26456,7 @@ fn fieldCallBind(...@@ -26456,7 +26456,7 @@ fn fieldCallBind(
26456 } };26456 } };
26457 } else if (first_param_type.zigTypeTag(zcu) == .optional) {26457 } else if (first_param_type.zigTypeTag(zcu) == .optional) {
26458 const child = first_param_type.optionalChild(zcu);26458 const child = first_param_type.optionalChild(zcu);
26459 if (child.eql(concrete_ty, zcu)) {26459 if (child.eql(concrete_ty)) {
26460 const deref = try sema.analyzeLoad(block, src, object_ptr, src);26460 const deref = try sema.analyzeLoad(block, src, object_ptr, src);
26461 return .{ .method = .{26461 return .{ .method = .{
26462 .func_inst = decl_val,26462 .func_inst = decl_val,
...@@ -26464,7 +26464,7 @@ fn fieldCallBind(...@@ -26464,7 +26464,7 @@ fn fieldCallBind(
26464 } };26464 } };
26465 } else if (child.zigTypeTag(zcu) == .pointer and26465 } else if (child.zigTypeTag(zcu) == .pointer and
26466 child.ptrSize(zcu) == .one and26466 child.ptrSize(zcu) == .one and
26467 child.childType(zcu).eql(concrete_ty, zcu))26467 child.childType(zcu).eql(concrete_ty))
26468 {26468 {
26469 return .{ .method = .{26469 return .{ .method = .{
26470 .func_inst = decl_val,26470 .func_inst = decl_val,
...@@ -26472,7 +26472,7 @@ fn fieldCallBind(...@@ -26472,7 +26472,7 @@ fn fieldCallBind(
26472 } };26472 } };
26473 }26473 }
26474 } else if (first_param_type.zigTypeTag(zcu) == .error_union and26474 } else if (first_param_type.zigTypeTag(zcu) == .error_union and
26475 first_param_type.errorUnionPayload(zcu).eql(concrete_ty, zcu))26475 first_param_type.errorUnionPayload(zcu).eql(concrete_ty))
26476 {26476 {
26477 const deref = try sema.analyzeLoad(block, src, object_ptr, src);26477 const deref = try sema.analyzeLoad(block, src, object_ptr, src);
26478 return .{ .method = .{26478 return .{ .method = .{
...@@ -27675,7 +27675,7 @@ fn coerceExtra(...@@ -27675,7 +27675,7 @@ fn coerceExtra(
27675 try sema.ensureLayoutResolved(dest_ty, inst_src, .coerce);27675 try sema.ensureLayoutResolved(dest_ty, inst_src, .coerce);
2767627676
27677 // If the types are the same, we can return the operand.27677 // If the types are the same, we can return the operand.
27678 if (dest_ty.eql(inst_ty, zcu))27678 if (dest_ty.eql(inst_ty))
27679 return inst;27679 return inst;
2768027680
27681 const maybe_inst_val = sema.resolveValue(inst);27681 const maybe_inst_val = sema.resolveValue(inst);
...@@ -28726,7 +28726,7 @@ pub fn coerceInMemoryAllowed(...@@ -28726,7 +28726,7 @@ pub fn coerceInMemoryAllowed(
28726 assert(val.typeOf(zcu).toIntern() == src_ty.toIntern());28726 assert(val.typeOf(zcu).toIntern() == src_ty.toIntern());
28727 }28727 }
2872828728
28729 if (dest_ty.eql(src_ty, zcu))28729 if (dest_ty.eql(src_ty))
28730 return .ok;28730 return .ok;
2873128731
28732 const dest_tag = dest_ty.zigTypeTag(zcu);28732 const dest_tag = dest_ty.zigTypeTag(zcu);
...@@ -32240,7 +32240,7 @@ fn resolvePeerTypesInner(...@@ -32240,7 +32240,7 @@ fn resolvePeerTypesInner(
32240 .nullable => {32240 .nullable => {
32241 for (peer_tys, 0..) |opt_ty, i| {32241 for (peer_tys, 0..) |opt_ty, i| {
32242 const ty = opt_ty orelse continue;32242 const ty = opt_ty orelse continue;
32243 if (!ty.eql(.null, zcu)) return .{ .conflict = .{32243 if (!ty.eql(.null)) return .{ .conflict = .{
32244 .peer_idx_a = strat_reason,32244 .peer_idx_a = strat_reason,
32245 .peer_idx_b = i,32245 .peer_idx_b = i,
32246 } };32246 } };
...@@ -32328,7 +32328,7 @@ fn resolvePeerTypesInner(...@@ -32328,7 +32328,7 @@ fn resolvePeerTypesInner(
32328 } };32328 } };
3232932329
32330 const peer_elem_ty = ty.childType(zcu);32330 const peer_elem_ty = ty.childType(zcu);
32331 if (!peer_elem_ty.eql(elem_ty, zcu)) coerce: {32331 if (!peer_elem_ty.eql(elem_ty)) coerce: {
32332 const peer_elem_coerces_to_elem =32332 const peer_elem_coerces_to_elem =
32333 try sema.coerceInMemoryAllowed(block, elem_ty, peer_elem_ty, false, zcu.getTarget(), src, src, null);32333 try sema.coerceInMemoryAllowed(block, elem_ty, peer_elem_ty, false, zcu.getTarget(), src, src, null);
32334 if (peer_elem_coerces_to_elem == .ok) {32334 if (peer_elem_coerces_to_elem == .ok) {
...@@ -32909,11 +32909,11 @@ fn resolvePeerTypesInner(...@@ -32909,11 +32909,11 @@ fn resolvePeerTypesInner(
32909 .@"enum" => switch (ty.zigTypeTag(zcu)) {32909 .@"enum" => switch (ty.zigTypeTag(zcu)) {
32910 .enum_literal => {},32910 .enum_literal => {},
32911 .@"enum" => {32911 .@"enum" => {
32912 if (!ty.eql(cur_ty, zcu)) return generic_err;32912 if (!ty.eql(cur_ty)) return generic_err;
32913 },32913 },
32914 .@"union" => {32914 .@"union" => {
32915 const tag_ty = ty.unionTagTypeHypothetical(zcu);32915 const tag_ty = ty.unionTagTypeHypothetical(zcu);
32916 if (!tag_ty.eql(cur_ty, zcu)) return generic_err;32916 if (!tag_ty.eql(cur_ty)) return generic_err;
32917 opt_cur_ty = ty;32917 opt_cur_ty = ty;
32918 cur_ty_idx = i;32918 cur_ty_idx = i;
32919 },32919 },
...@@ -32923,10 +32923,10 @@ fn resolvePeerTypesInner(...@@ -32923,10 +32923,10 @@ fn resolvePeerTypesInner(
32923 .enum_literal => {},32923 .enum_literal => {},
32924 .@"enum" => {32924 .@"enum" => {
32925 const cur_tag_ty = cur_ty.unionTagTypeHypothetical(zcu);32925 const cur_tag_ty = cur_ty.unionTagTypeHypothetical(zcu);
32926 if (!ty.eql(cur_tag_ty, zcu)) return generic_err;32926 if (!ty.eql(cur_tag_ty)) return generic_err;
32927 },32927 },
32928 .@"union" => {32928 .@"union" => {
32929 if (!ty.eql(cur_ty, zcu)) return generic_err;32929 if (!ty.eql(cur_ty)) return generic_err;
32930 },32930 },
32931 else => unreachable,32931 else => unreachable,
32932 },32932 },
...@@ -33059,7 +33059,7 @@ fn resolvePeerTypesInner(...@@ -33059,7 +33059,7 @@ fn resolvePeerTypesInner(
33059 .comptime_float, .comptime_int, .int => {},33059 .comptime_float, .comptime_int, .int => {},
33060 .float => {33060 .float => {
33061 if (opt_cur_ty) |cur_ty| {33061 if (opt_cur_ty) |cur_ty| {
33062 if (cur_ty.eql(ty, zcu)) continue;33062 if (cur_ty.eql(ty)) continue;
33063 // Recreate the type so we eliminate any c_longdouble33063 // Recreate the type so we eliminate any c_longdouble
33064 const bits = @max(cur_ty.floatBits(target), ty.floatBits(target));33064 const bits = @max(cur_ty.floatBits(target), ty.floatBits(target));
33065 opt_cur_ty = switch (bits) {33065 opt_cur_ty = switch (bits) {
...@@ -33234,7 +33234,7 @@ fn resolvePeerTypesInner(...@@ -33234,7 +33234,7 @@ fn resolvePeerTypesInner(
33234 for (peer_tys, 0..) |opt_ty, i| {33234 for (peer_tys, 0..) |opt_ty, i| {
33235 const ty = opt_ty orelse continue;33235 const ty = opt_ty orelse continue;
33236 if (expect_ty) |expect| {33236 if (expect_ty) |expect| {
33237 if (!ty.eql(expect, zcu)) return .{ .conflict = .{33237 if (!ty.eql(expect)) return .{ .conflict = .{
33238 .peer_idx_a = first_idx,33238 .peer_idx_a = first_idx,
33239 .peer_idx_b = i,33239 .peer_idx_b = i,
33240 } };33240 } };
...@@ -33300,7 +33300,7 @@ fn typeIsArrayLike(sema: *Sema, ty: Type) ?ArrayLike {...@@ -33300,7 +33300,7 @@ fn typeIsArrayLike(sema: *Sema, ty: Type) ?ArrayLike {
33300 };33300 };
33301 const elem_ty = ty.fieldType(0, zcu);33301 const elem_ty = ty.fieldType(0, zcu);
33302 for (1..field_count) |i| {33302 for (1..field_count) |i| {
33303 if (!ty.fieldType(i, zcu).eql(elem_ty, zcu)) {33303 if (!ty.fieldType(i, zcu).eql(elem_ty)) {
33304 return null;33304 return null;
33305 }33305 }
33306 }33306 }
src/Type.zig+1-2
...@@ -385,8 +385,7 @@ pub fn ptrInfo(ty: Type, zcu: *const Zcu) InternPool.Key.PtrType {...@@ -385,8 +385,7 @@ pub fn ptrInfo(ty: Type, zcu: *const Zcu) InternPool.Key.PtrType {
385 };385 };
386}386}
387387
388pub fn eql(a: Type, b: Type, zcu: *const Zcu) bool {388pub fn eql(a: Type, b: Type) bool {
389 _ = zcu; // TODO: remove this parameter
390 // The InternPool data structure hashes based on Key to make interned objects389 // The InternPool data structure hashes based on Key to make interned objects
391 // unique. An Index can be treated simply as u32 value for the390 // unique. An Index can be treated simply as u32 value for the
392 // purpose of Type/Value hashing and equality.391 // purpose of Type/Value hashing and equality.
src/codegen/c.zig+3-3
...@@ -1120,7 +1120,7 @@ pub const DeclGen = struct {...@@ -1120,7 +1120,7 @@ pub const DeclGen = struct {
1120 }1120 }
1121 try w.writeByte('{');1121 try w.writeByte('{');
1122 const ai = ty.arrayInfo(zcu);1122 const ai = ty.arrayInfo(zcu);
1123 if (ai.elem_type.eql(.u8, zcu)) {1123 if (ai.elem_type.eql(.u8)) {
1124 var literal: StringLiteral = .init(w, @intCast(ty.arrayLenIncludingSentinel(zcu)));1124 var literal: StringLiteral = .init(w, @intCast(ty.arrayLenIncludingSentinel(zcu)));
1125 try literal.start();1125 try literal.start();
1126 var index: usize = 0;1126 var index: usize = 0;
...@@ -1539,7 +1539,7 @@ pub const DeclGen = struct {...@@ -1539,7 +1539,7 @@ pub const DeclGen = struct {
1539 }1539 }
1540 try w.writeByte('{');1540 try w.writeByte('{');
1541 const ai = ty.arrayInfo(zcu);1541 const ai = ty.arrayInfo(zcu);
1542 if (ai.elem_type.eql(.u8, zcu)) {1542 if (ai.elem_type.eql(.u8)) {
1543 var literal: StringLiteral = .init(w, @intCast(ty.arrayLenIncludingSentinel(zcu)));1543 var literal: StringLiteral = .init(w, @intCast(ty.arrayLenIncludingSentinel(zcu)));
1544 try literal.start();1544 try literal.start();
1545 var index: u64 = 0;1545 var index: u64 = 0;
...@@ -3428,7 +3428,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {...@@ -3428,7 +3428,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
3428 if (!is_aligned) {3428 if (!is_aligned) {
3429 // For this memcpy to safely work we need the rhs to have the same3429 // For this memcpy to safely work we need the rhs to have the same
3430 // underlying type as the lhs (i.e. they must both be arrays of the same underlying type).3430 // underlying type as the lhs (i.e. they must both be arrays of the same underlying type).
3431 assert(src_ty.eql(.fromInterned(ptr_info.child), zcu));3431 assert(src_ty.eql(.fromInterned(ptr_info.child)));
34323432
3433 const v = try Vectorize.start(f, inst, w, ptr_ty);3433 const v = try Vectorize.start(f, inst, w, ptr_ty);
3434 try w.writeAll("memcpy((char *)");3434 try w.writeAll("memcpy((char *)");
src/codegen/riscv64/CodeGen.zig+1-1
...@@ -3163,7 +3163,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void {...@@ -3163,7 +3163,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void {
3163 switch (lhs_ty.zigTypeTag(zcu)) {3163 switch (lhs_ty.zigTypeTag(zcu)) {
3164 else => |x| return func.fail("TODO: airMulWithOverflow {s}", .{@tagName(x)}),3164 else => |x| return func.fail("TODO: airMulWithOverflow {s}", .{@tagName(x)}),
3165 .int => {3165 .int => {
3166 if (std.debug.runtime_safety) assert(lhs_ty.eql(rhs_ty, zcu));3166 if (std.debug.runtime_safety) assert(lhs_ty.eql(rhs_ty));
31673167
3168 const trunc_reg = try func.copyToTmpRegister(lhs_ty, .{ .register = dest_reg });3168 const trunc_reg = try func.copyToTmpRegister(lhs_ty, .{ .register = dest_reg });
3169 const trunc_reg_lock = func.register_manager.lockRegAssumeUnused(trunc_reg);3169 const trunc_reg_lock = func.register_manager.lockRegAssumeUnused(trunc_reg);
src/codegen/sparc64/CodeGen.zig+6-6
...@@ -744,7 +744,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -744,7 +744,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
744 switch (lhs_ty.zigTypeTag(zcu)) {744 switch (lhs_ty.zigTypeTag(zcu)) {
745 .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),745 .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
746 .int => {746 .int => {
747 assert(lhs_ty.eql(rhs_ty, zcu));747 assert(lhs_ty.eql(rhs_ty));
748 const int_info = lhs_ty.intInfo(zcu);748 const int_info = lhs_ty.intInfo(zcu);
749 switch (int_info.bits) {749 switch (int_info.bits) {
750 32, 64 => {750 32, 64 => {
...@@ -1797,7 +1797,7 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void {...@@ -1797,7 +1797,7 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void {
1797 const rhs = try self.resolveInst(bin_op.rhs);1797 const rhs = try self.resolveInst(bin_op.rhs);
1798 const lhs_ty = self.typeOf(bin_op.lhs);1798 const lhs_ty = self.typeOf(bin_op.lhs);
1799 const rhs_ty = self.typeOf(bin_op.rhs);1799 const rhs_ty = self.typeOf(bin_op.rhs);
1800 assert(lhs_ty.eql(rhs_ty, self.pt.zcu));1800 assert(lhs_ty.eql(rhs_ty));
18011801
1802 if (self.liveness.isUnused(inst))1802 if (self.liveness.isUnused(inst))
1803 return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none });1803 return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none });
...@@ -1950,7 +1950,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -1950,7 +1950,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
1950 switch (lhs_ty.zigTypeTag(zcu)) {1950 switch (lhs_ty.zigTypeTag(zcu)) {
1951 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),1951 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
1952 .int => {1952 .int => {
1953 assert(lhs_ty.eql(rhs_ty, zcu));1953 assert(lhs_ty.eql(rhs_ty));
1954 const int_info = lhs_ty.intInfo(zcu);1954 const int_info = lhs_ty.intInfo(zcu);
1955 switch (int_info.bits) {1955 switch (int_info.bits) {
1956 1...32 => {1956 1...32 => {
...@@ -2780,7 +2780,7 @@ fn binOp(...@@ -2780,7 +2780,7 @@ fn binOp(
2780 .float => return self.fail("TODO binary operations on floats", .{}),2780 .float => return self.fail("TODO binary operations on floats", .{}),
2781 .vector => return self.fail("TODO binary operations on vectors", .{}),2781 .vector => return self.fail("TODO binary operations on vectors", .{}),
2782 .int => {2782 .int => {
2783 assert(lhs_ty.eql(rhs_ty, zcu));2783 assert(lhs_ty.eql(rhs_ty));
2784 const int_info = lhs_ty.intInfo(zcu);2784 const int_info = lhs_ty.intInfo(zcu);
2785 if (int_info.bits <= 64) {2785 if (int_info.bits <= 64) {
2786 // Only say yes if the operation is2786 // Only say yes if the operation is
...@@ -2870,7 +2870,7 @@ fn binOp(...@@ -2870,7 +2870,7 @@ fn binOp(
2870 switch (lhs_ty.zigTypeTag(zcu)) {2870 switch (lhs_ty.zigTypeTag(zcu)) {
2871 .vector => return self.fail("TODO binary operations on vectors", .{}),2871 .vector => return self.fail("TODO binary operations on vectors", .{}),
2872 .int => {2872 .int => {
2873 assert(lhs_ty.eql(rhs_ty, zcu));2873 assert(lhs_ty.eql(rhs_ty));
2874 const int_info = lhs_ty.intInfo(zcu);2874 const int_info = lhs_ty.intInfo(zcu);
2875 if (int_info.bits <= 64) {2875 if (int_info.bits <= 64) {
2876 const rhs_immediate_ok = switch (tag) {2876 const rhs_immediate_ok = switch (tag) {
...@@ -4226,7 +4226,7 @@ fn minMax(...@@ -4226,7 +4226,7 @@ fn minMax(
4226) InnerError!MCValue {4226) InnerError!MCValue {
4227 const pt = self.pt;4227 const pt = self.pt;
4228 const zcu = pt.zcu;4228 const zcu = pt.zcu;
4229 assert(lhs_ty.eql(rhs_ty, zcu));4229 assert(lhs_ty.eql(rhs_ty));
4230 switch (lhs_ty.zigTypeTag(zcu)) {4230 switch (lhs_ty.zigTypeTag(zcu)) {
4231 .float => return self.fail("TODO min/max on floats", .{}),4231 .float => return self.fail("TODO min/max on floats", .{}),
4232 .vector => return self.fail("TODO min/max on vectors", .{}),4232 .vector => return self.fail("TODO min/max on vectors", .{}),
src/codegen/spirv/CodeGen.zig+1-1
...@@ -4633,7 +4633,7 @@ fn unionInit(...@@ -4633,7 +4633,7 @@ fn unionInit(
4633 const layout_payload_ty_id = try cg.resolveType(layout.payload_ty, .indirect);4633 const layout_payload_ty_id = try cg.resolveType(layout.payload_ty, .indirect);
4634 const pl_ptr_ty_id = try cg.module.ptrType(layout_payload_ty_id, .function);4634 const pl_ptr_ty_id = try cg.module.ptrType(layout_payload_ty_id, .function);
4635 const pl_ptr_id = try cg.accessChain(pl_ptr_ty_id, tmp_id, &.{layout.payload_index});4635 const pl_ptr_id = try cg.accessChain(pl_ptr_ty_id, tmp_id, &.{layout.payload_index});
4636 const active_pl_ptr_id = if (!layout.payload_ty.eql(payload_ty, zcu)) blk: {4636 const active_pl_ptr_id = if (!layout.payload_ty.eql(payload_ty)) blk: {
4637 const payload_ty_id = try cg.resolveType(payload_ty, .indirect);4637 const payload_ty_id = try cg.resolveType(payload_ty, .indirect);
4638 const active_pl_ptr_ty_id = try cg.module.ptrType(payload_ty_id, .function);4638 const active_pl_ptr_ty_id = try cg.module.ptrType(payload_ty_id, .function);
4639 const active_pl_ptr_id = cg.module.allocId();4639 const active_pl_ptr_id = cg.module.allocId();