Context
home #25 fixed the AddressOf typing bug for simple &arr[i] and &struct.field patterns. The 2026-05-04-night audit found 10 residual Argument type mismatch failures that are all chained address-of expressions where the wrap-in-Reference still doesn't fire.
Affected patterns
&mount_table[0].device // &array[i].field — index then field access
&caches[CACHE_PCB] // &array[const_id] — index by named const
&caches[CACHE_INODE] // same
&mount_table[1].device // same as firstFiles (from ~/Desktop/home-os-kernel-audit-2026-05-04-night.tsv):
kernel/src/core/filesystem.homekernel/src/mm/kmem_cache.homekernel/src/core/vfs_block_io.homekernel/src/drivers/sdmmc_*.homekernel/src/sys/syscall.homekernel/src/net/wifi_bt_*.homekernel/src/perf/sd_benchmark.home
Hypothesis
#25's fix in inferUnaryExprWithHint for AddressOf likely only fires when the operand is a direct IndexExpr or MemberExpr. When the operand is MemberExpr(IndexExpr(...)) (&arr[i].field) or when the index is a non-literal (CACHE_PCB is an enum variant or const), the path falls through.
Reproduction
struct Cache { id: u32, name: [16]u8 }
const CACHE_INODE: u32 = 0
var caches: [4]Cache = [...]
fn use_cache(c: *Cache) {}
fn use_field(p: *u32) {}
fn caller() {
use_cache(&caches[CACHE_INODE]) // fails: chained address-of with const index
use_field(&caches[0].id) // fails: chained address-of with field
}Fix
Extend the AddressOf case in inferUnaryExprWithHint (packages/types/src/type_system.zig) to recurse into composed lvalue expressions. The result type is always *T where T is the inner expression's value type, regardless of nesting depth.
Why this matters
10 home-os kernel modules unblocked. Highest leverage per LoC remaining.
Reference
- Predecessor: home-lang/home #25 (closed)
- Audit:
~/Desktop/home-os-kernel-audit-2026-05-04-night.tsv