zig/test/behavior/bugs/12885.zig
r00ster91 7350ea3e2d std.builtin: rename Type.Fn's args to params
This was a poor naming choice; these are parameters, not arguments.
Parameters specify what kind of arguments are expected, whereas the arguments are the actual values passed.
2022-12-17 14:11:33 +01:00

35 lines
754 B
Zig

const std = @import("std");
const builtin = std.builtin;
const expect = std.testing.expect;
const info = .{
.args = [_]builtin.Type.Error{
.{ .name = "bar" },
},
};
const Foo = @Type(.{
.ErrorSet = &info.args,
});
test "ErrorSet comptime_field_ptr" {
try expect(Foo == error{bar});
}
const fn_info = .{
.params = [_]builtin.Type.Fn.Param{
.{ .is_generic = false, .is_noalias = false, .type = u8 },
},
};
const Bar = @Type(.{
.Fn = .{
.calling_convention = .Unspecified,
.alignment = 0,
.is_generic = false,
.is_var_args = false,
.return_type = void,
.params = &fn_info.params,
},
});
test "fn comptime_field_ptr" {
try expect(@typeInfo(Bar) == .Fn);
}