Problem
The parser does not accept fn(...) Ret in type-alias position, even though it likely accepts it elsewhere (e.g. function-pointer fields):
pub const BlockReadFn = fn(lba: u64, count: u32, buffer: [*]u8) bool
pub const SyscallHandler = fn(u64, u64, u64, u64, u64, u64) u64
var block_read_fn: ?BlockReadFn = null
var syscall_table: [MAX_SYSCALLS]?SyscallHandler = undefinedDiagnostic: error[EP0001]: Expected ')' in function type at the ( after fn.
Affected kernel files
- kernel/src/fs/partition.home:135 (
pub const BlockReadFn = fn(...) bool) - kernel/src/arch/x86_64/syscall_fast.home:91 (
pub const SyscallHandler = fn(...) u64)
Expected behavior
Accept the same fn(...) Ret type grammar in pub const Foo = ... as in struct-field / variable type annotation. Both named and unnamed parameter forms should work:
pub const Named = fn(lba: u64, count: u32) bool;
pub const Unnamed = fn(u64, u32) bool;
pub const NoReturn = fn(u64); // void
pub const PtrParam = fn(buf: [*]u8) void;
pub const OptArg = ?fn() void; // nullableImplementation hint
Where pub const X = ... parses the right-hand side, route through the same type-expression entry point used by struct fields. The fn keyword in type position should produce a Type.Function node whether it's parsed in a struct field, a variable annotation, or a type alias.
Tests
- Positive: each of the 4 forms above
- Regression: existing
pub const Foo = u32;(primitive alias) keeps working - Regression: existing function-pointer field types keep working
Acceptance
- The 2 listed kernel files clear
home-debug astpast the function-type-alias point. - Existing test suite green.