| ... | ... | @@ -1037,14 +1037,12 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 1037 | 1037 | @compileError("ArgsTuple expects a function type"); |
| 1038 | 1038 | |
| 1039 | 1039 | const function_info = info.Fn; |
| 1040 | | if (function_info.is_generic) |
| 1041 | | @compileError("Cannot create ArgsTuple for generic function"); |
| 1042 | 1040 | if (function_info.is_var_args) |
| 1043 | 1041 | @compileError("Cannot create ArgsTuple for variadic function"); |
| 1044 | 1042 | |
| 1045 | 1043 | var argument_field_list: [function_info.params.len]type = undefined; |
| 1046 | 1044 | inline for (function_info.params, 0..) |arg, i| { |
| 1047 | | const T = arg.type.?; |
| 1045 | const T = arg.type orelse @compileError("cannot create ArgsTuple for function with an 'anytype' parameter"); |
| 1048 | 1046 | argument_field_list[i] = T; |
| 1049 | 1047 | } |
| 1050 | 1048 | |
| ... | ... | @@ -1116,6 +1114,7 @@ test "ArgsTuple" { |
| 1116 | 1114 | TupleTester.assertTuple(.{u32}, ArgsTuple(fn (a: u32) []const u8)); |
| 1117 | 1115 | TupleTester.assertTuple(.{ u32, f16 }, ArgsTuple(fn (a: u32, b: f16) noreturn)); |
| 1118 | 1116 | TupleTester.assertTuple(.{ u32, f16, []const u8, void }, ArgsTuple(fn (a: u32, b: f16, c: []const u8, void) noreturn)); |
| 1117 | TupleTester.assertTuple(.{u32}, ArgsTuple(fn (comptime a: u32) []const u8)); |
| 1119 | 1118 | } |
| 1120 | 1119 | |
| 1121 | 1120 | test "Tuple" { |