ReviewOS

home-lang/home

Regression: parser infinite loop on `type` as struct-field name (introduced by #28)

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

Context

The 2026-05-05-evening audit found 17 home-os kernel modules now hang the compiler past 90s — all use `type` as a struct field name. The hang was introduced by home #28 (unified struct-body / struct-literal fix).

Reproduction (4 lines)

```home struct S { type: u32, x: u32, } ```

Saved as `/tmp/repro.home`:

```bash ./zig-out/bin/home-debug ast /tmp/repro.home # hangs >90s ```

Renaming the field to `kind` parses in 18ms. The hang is specific to `type` (and presumably any other reserved keyword used as a struct field name in the new struct-body parser path).

Hypothesis

home #28 added support for nested declarations (`pub const Foo = enum { ... }` etc.) inside struct bodies. When it sees `type` after a field-list comma/newline, it likely tries to parse a `type` declaration (Zig-style `type Foo = …` or similar), fails to make progress, and loops.

The fix likely involves:

  1. Detecting that `type` followed by `:` is a field name, not the start of a type-decl
  2. OR adding a progress guard in the struct-body loop (similar to home #16's parser hang fix in the top-level parse loop)

Affected files (17 confirmed via TIMEOUT classification in 2026-05-05-evening audit)

Filter `~/Desktop/home-os-kernel-audit-2026-05-05-evening.tsv` for `TIMEOUT` rows. Includes:

  • Several files in `arch/arm64/rpi/` and `arch/arm64/`
  • `fs/` files
  • `iot/` files
  • `container/` files

Why this matters

Critical regression — was previously OK, now hangs the compiler. Single fix unblocks 17 files. Without this fix, kernel pass-rate is artificially capped at 66.8% (vs morning's 71.0%).

Reference

  • Audit: `~/Desktop/home-os-kernel-audit-2026-05-05-evening.tsv`
  • Repro on disk: `/tmp/repro/a.home`
  • Original feature: home-lang/home #28 (closed) — parser unified struct-body fix
  • Similar pattern (parser hang fix): home-lang/home #16 (closed) — added progress guard

Sign in to comment on this issue.