ReviewOS

home-lang/home

Parser: support module-scope `var x: [T; N] = undefined` (the #35 sibling case)

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

Context

home #35 fixed `var x: [T; N]` (no init) and `var x: [T; N] align(M)` at function scope. The same shape at module scope with an explicit `= undefined` initializer still fails to parse.

Reproduction

var pci_devices: [PCIDevice; 64] = undefined   // currently fails at module scope

`fn f() { var pci_devices: [PCIDevice; 64] = undefined }` (function scope) likely works after #35.

Affected files

5-8 home-os files. Pull from `/Desktop/home-os-kernel-audit-2026-05-06.tsv` filtering for `Undefined variable` cascades or `DebugAllocator` leaks. Confirmed: `drivers/pci.home`, `drivers/ahci.home`.

Fix

In the var-declaration parser, the path that handles `[T; N]` arrays. The function-scope code path was fixed in #35 but the module-scope code path is separate. Mirror the fix.

Why this matters

5-8 modules unblocked. Pairs naturally with home #36 (which would expose more files of this shape).

Reference

  • Predecessor: home #35 (closed)
  • 2026-05-06 audit

Sign in to comment on this issue.