ReviewOS

home-lang/home

Parser: many-pointer types `[*]T` and `[*]const T`

#29
Closed glennmichael123 opened this 24 days ago · 0 comments
24 days ago

Context

The 2026-05-04-night audit's scout triage found 2 home-os kernel files (likely more in the typecheck bucket cascading from this) where [*]const T and [*]T many-pointer types fail to parse with Expected type name.

Reproduction

fn f(p: [*]const u8) i32 { return 0 }   // fails
fn g(p: [*]u8) i32 { return 0 }          // also fails

fn h(x: u8) {
  let p = @as([*]const u8, ptr_expr)    // fails inside builtin args too
}

Affected files

  • kernel/src/mm/swapfile.home:162
  • kernel/src/security/secure_boot.home:68 (inside @as(...))

Plus likely silent contributions to other typecheck-bucket failures whose first error masks the underlying many-pointer issue.

Fix

In parseTypeAnnotation (or wherever pointer types are parsed in packages/parser/src/parser.zig), add the [*]T and [*]const T forms alongside existing *T, *const T, ?T. The lexer already produces the right tokens ([, *, ]); just need the type parser to recognize the sequence.

Result type: same as *T / *const T for the typechecker, OR a distinct ManyPointer variant if the type system needs to distinguish (Zig does — [*]T is unbounded vs *T which is single-element). Pick whichever the existing reference/pointer-type infrastructure supports cleanly.

Why this matters

Standard systems-language idiom. Probably ~5-10 modules unblocked once cascades clear.

Reference

  • 2026-05-04-night audit
  • Scout triage report

Sign in to comment on this issue.