| ... | ... | @@ -846,14 +846,15 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 846 | 846 | |
| 847 | 847 | var argument_field_list: [function_info.args.len]std.builtin.TypeInfo.StructField = undefined; |
| 848 | 848 | inline for (function_info.args) |arg, i| { |
| 849 | const T = arg.arg_type.?; |
| 849 | 850 | @setEvalBranchQuota(10_000); |
| 850 | 851 | var num_buf: [128]u8 = undefined; |
| 851 | 852 | argument_field_list[i] = std.builtin.TypeInfo.StructField{ |
| 852 | 853 | .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable, |
| 853 | | .field_type = arg.arg_type.?, |
| 854 | | .default_value = @as(?(arg.arg_type.?), null), |
| 854 | .field_type = T, |
| 855 | .default_value = @as(?T, null), |
| 855 | 856 | .is_comptime = false, |
| 856 | | .alignment = @alignOf(arg.arg_type.?), |
| 857 | .alignment = if (@sizeOf(T) > 0) @alignOf(T) else 0, |
| 857 | 858 | }; |
| 858 | 859 | } |
| 859 | 860 | |
| ... | ... | @@ -884,7 +885,7 @@ pub fn Tuple(comptime types: []const type) type { |
| 884 | 885 | .field_type = T, |
| 885 | 886 | .default_value = @as(?T, null), |
| 886 | 887 | .is_comptime = false, |
| 887 | | .alignment = @alignOf(T), |
| 888 | .alignment = if (@sizeOf(T) > 0) @alignOf(T) else 0, |
| 888 | 889 | }; |
| 889 | 890 | } |
| 890 | 891 | |
| ... | ... | @@ -927,12 +928,12 @@ test "ArgsTuple" { |
| 927 | 928 | TupleTester.assertTuple(.{}, ArgsTuple(fn () void)); |
| 928 | 929 | TupleTester.assertTuple(.{u32}, ArgsTuple(fn (a: u32) []const u8)); |
| 929 | 930 | TupleTester.assertTuple(.{ u32, f16 }, ArgsTuple(fn (a: u32, b: f16) noreturn)); |
| 930 | | TupleTester.assertTuple(.{ u32, f16, []const u8 }, ArgsTuple(fn (a: u32, b: f16, c: []const u8) noreturn)); |
| 931 | TupleTester.assertTuple(.{ u32, f16, []const u8, void }, ArgsTuple(fn (a: u32, b: f16, c: []const u8, void) noreturn)); |
| 931 | 932 | } |
| 932 | 933 | |
| 933 | 934 | test "Tuple" { |
| 934 | 935 | TupleTester.assertTuple(.{}, Tuple(&[_]type{})); |
| 935 | 936 | TupleTester.assertTuple(.{u32}, Tuple(&[_]type{u32})); |
| 936 | 937 | TupleTester.assertTuple(.{ u32, f16 }, Tuple(&[_]type{ u32, f16 })); |
| 937 | | TupleTester.assertTuple(.{ u32, f16, []const u8 }, Tuple(&[_]type{ u32, f16, []const u8 })); |
| 938 | TupleTester.assertTuple(.{ u32, f16, []const u8, void }, Tuple(&[_]type{ u32, f16, []const u8, void })); |
| 938 | 939 | } |