Skip to content

Commit e7c2212

Browse files
committed
Allow getter/setter with only a UserContext parameter.
1 parent 64b9b2b commit e7c2212

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/reflect.zig

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ pub const Func = struct {
633633
// check getter and setter internal argument is an allocator
634634
if (kind == .getter or kind == .setter) {
635635
if (index_offset == 1) {
636-
if (args[0].type.? != std.mem.Allocator) {
636+
if (isInternalType(args[0].type.?) == false) {
637637
const msg = "getter/setter non-internal argument should be an allocator";
638638
fmtErr(msg.len, msg, T);
639639
return error.FuncGetterSetterNotAllocator;
@@ -2053,11 +2053,6 @@ const TestFuncNoSelf = struct {
20532053
const TestFuncGetterMultiArg = struct {
20542054
pub fn get_example(_: TestFuncGetterMultiArg, _: bool) void {}
20552055
};
2056-
const TestFuncGetterSetterNotAllocator = struct {
2057-
pub fn get_example(_: TestFuncGetterSetterNotAllocator, _: *Loop) bool {
2058-
return true;
2059-
}
2060-
};
20612056
const TestFuncSetterFirstArgNotSelfPtr = struct {
20622057
pub fn set_example(_: TestFuncSetterFirstArgNotSelfPtr) void {}
20632058
};
@@ -2207,10 +2202,6 @@ pub fn tests() !void {
22072202
.{TestFuncGetterMultiArg},
22082203
error.FuncGetterMultiArg,
22092204
);
2210-
try ensureErr(
2211-
.{TestFuncGetterSetterNotAllocator},
2212-
error.FuncGetterSetterNotAllocator,
2213-
);
22142205
try ensureErr(
22152206
.{TestFuncSetterFirstArgNotSelfPtr},
22162207
error.FuncSetterFirstArgNotSelfPtr,

0 commit comments

Comments
 (0)