Problem
The parser requires the OLD 3-arg form for @memset and @memcpy builtins, but the kernel uses the modern Zig 0.11+ 2-arg form throughout:
@memset(&config.ssid, 0) // 2-arg — fails today
@memcpy(region.name[0..copy_len], name[0..n]) // 2-arg — fails today
@memset(x, 0, 8) // 3-arg — currently works
@memcpy(a, b, 8) // 3-arg — currently worksDiagnostic: error[EP0001]: Expected ',' between arguments at the closing ). The parser sees 2 args and expects a 3rd, demanding another separator.
Background
Zig migrated these builtins from 3-arg @memset(dest, byte, len) / @memcpy(dest, src, len) to 2-arg @memset(slice, byte) / @memcpy(dst_slice, src_slice) in Zig 0.11. The kernel is written against modern Zig; the parser should accept the 2-arg form (and probably keep accepting the 3-arg for back-compat, or reject it cleanly).
Scope
$ grep -rn "@memset\|@memcpy" home-os/kernel/src --include='*.home' | wc -l
271
$ grep -rEn "@memset\([^,]+,[^,)]+\)|@memcpy\([^,]+,[^,)]+\)" home-os/kernel/src --include='*.home' | wc -l
260260 sites use the 2-arg form. Many of these are the FIRST parse error in their respective files — fixing this should clear or substantially-progress dozens of currently-failing files.
Expected behavior
Both forms accepted:
@memset(slice, byte) // 2-arg, slice version (preferred, Zig 0.11+)
@memcpy(dst_slice, src_slice) // 2-arg, slice version
@memset(ptr, byte, len) // 3-arg, ptr+len (legacy — keep accepting)
@memcpy(dst_ptr, src_ptr, len) // 3-arg, ptr+len (legacy)Cleanest implementation: drop the hardcoded 3-arg arity check on these builtins and accept arbitrary arg counts in the parser. The typechecker already validates against the actual builtin signature; parser doesn't need to second-guess.
Implementation hint
In packages/parser/src/parser.zig, find where builtin-call parsing has special-case handling for @memset / @memcpy (likely in a parseBuiltinCall or similar). Remove the arity check, or extend it to accept 2-arg. The typechecker then handles signature validation.
Tests
- Positive:
@memset(slice, byte)(2-arg) - Positive:
@memcpy(dst, src)(2-arg) - Regression:
@memset(p, b, n)(3-arg, legacy) keeps working - Regression:
@memcpy(d, s, n)(3-arg, legacy) keeps working
Acceptance
- Many kernel files that currently fail at
@memset(...)/@memcpy(...)lines now parse past them. - Existing test suite green.