ReviewOS

home-lang/home

`@as(*T, ...)` / `@ptrCast(*T, ...)` builtin calls with pointer-type args fail to parse

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

Context

2026-05-04 PM kernel audit (post #14/#15/#18) found 12 modules failing with `Expected ',' after type argument` — all on home builtin calls with a pointer type as the first argument. Examples:

```home let p = @as(*T, expr) // fails let q = @ptrCast(*T, expr) // fails ```

The parser treats `T` as the start of a generic argument list (presumably `` as a multiplicative operator beginning an expression of generic type), instead of recognizing the pointer type form.

Affected files (from audit)

12 modules total. Load-bearing examples:

  • `kernel/src/arch/arm64/devicetree.home`
  • `kernel/src/container/namespaces.home`
  • `kernel/src/debug/panic.home`

(Pull the full list from `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv` filtering for `first_error` = `Expected ',' after type argument`.)

Hypothesis

Likely a one-liner fix in the parser's builtin-call argument parsing — when parsing the type-position argument, it needs to accept `T`/`[]T`/etc. pointer forms before falling through to expression parsing.

Why this matters

Top-of-list leverage in the latest audit. Unblocks 12 modules that were previously OK at `ast` but failing at `check`'s deeper parse. #1 of 5 ranked follow-ups in the 2026-05-04-pm audit.

Reproduction

```bash echo 'fn main() { let p = @as(*u8, foo) }' > /tmp/t.home ./zig-out/bin/home-debug check /tmp/t.home ```

Reference

  • Audit: `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv`
  • Builds on home #18 (parser grammar gaps), home #16 (parser hang fix)

Sign in to comment on this issue.