Skip to content

Commit d7f632f

Browse files
committed
stage2: fix hash/eql on function types
to account for generic callconv and generic alignment.
1 parent 4e6a0a2 commit d7f632f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/type.zig

+10-6
Original file line numberDiff line numberDiff line change
@@ -640,16 +640,16 @@ pub const Type = extern union {
640640
if (!eql(a_info.return_type, b_info.return_type, mod))
641641
return false;
642642

643-
if (a_info.cc != b_info.cc)
643+
if (a_info.is_var_args != b_info.is_var_args)
644644
return false;
645645

646-
if (a_info.alignment != b_info.alignment)
646+
if (a_info.is_generic != b_info.is_generic)
647647
return false;
648648

649-
if (a_info.is_var_args != b_info.is_var_args)
649+
if (!a_info.cc_is_generic and a_info.cc != b_info.cc)
650650
return false;
651651

652-
if (a_info.is_generic != b_info.is_generic)
652+
if (!a_info.align_is_generic and a_info.alignment != b_info.alignment)
653653
return false;
654654

655655
if (a_info.param_types.len != b_info.param_types.len)
@@ -1039,8 +1039,12 @@ pub const Type = extern union {
10391039
if (fn_info.return_type.tag() != .generic_poison) {
10401040
hashWithHasher(fn_info.return_type, hasher, mod);
10411041
}
1042-
std.hash.autoHash(hasher, fn_info.alignment);
1043-
std.hash.autoHash(hasher, fn_info.cc);
1042+
if (!fn_info.align_is_generic) {
1043+
std.hash.autoHash(hasher, fn_info.alignment);
1044+
}
1045+
if (!fn_info.cc_is_generic) {
1046+
std.hash.autoHash(hasher, fn_info.cc);
1047+
}
10441048
std.hash.autoHash(hasher, fn_info.is_var_args);
10451049
std.hash.autoHash(hasher, fn_info.is_generic);
10461050

0 commit comments

Comments
 (0)