Problem
The authoritative Home checker visits reflection builtin operands but returns void for every ReflectExpr. Valid systems expressions such as @as(u64, width), @intFromPtr(ptr), context-typed @intCast(value), and @as(*u8, @ptrFromInt(addr)).* consequently produce false arithmetic, assignment, and call-argument errors.
Evidence
TypeChecker.inferExpression currently handles .ReflectExpr by traversing its arguments and unconditionally break :blk Type.Void. The parser already preserves each builtin kind and optional target type, and kernel codegen already lowers these casts. On current home-os origin/main, the first post-never failures at kernel/src/main.home:201, :257, :266, and :318 all flow from the lost result type.
Scope
- Infer explicit cast target types from
ReflectExpr.target_type. - Use contextual result types for target-elided casts such as
@intCast(value). - Give fixed-result pointer/integer and metadata builtins their semantic types.
- Preserve operand traversal, unsafe raw-pointer checks, and uninitialized-storage tracking.
- Add focused checker coverage for the kernel cast chain.
Acceptance criteria
- Explicit
@as/@intCastresults retain the declared target type. @intFromPtris integer-typed.- Contextual
@ptrFromIntcan flow into an explicit pointer cast and dereference insideunsafe. - The focused checker suite remains green and the kernel corpus loses the related false diagnostics.
Links
Blocks the remaining kernel-corpus acceptance item in #787. Part of #814.