cmd+selfhost+test: predeclare nomem in universe scope
Per Hare convention, `nomem` is a language-level error type — no
import required, in scope alongside void/done/rune/str. ref/hare uses
it bare at errors/string.ha:14, types/c/strings.ha:89, net/uri/parse.ha:17
with no `use`. Precondition for graduating the `alloc` builtin to
`(*T | nomem)` returns.
cstage: ty_nomem is NAMED{under=ty_void, iserror=1}, installed by
typesinit and surfaced via lookup_builtin. wwstage seeds the same
shape in both check.ww (scope) and cgen.ww (aliases) — separate
tables, both consulted; without the cgen seed wwstage drops the
zero-init for `let e: nomem;` locals and breaks byte-identity.
Tests: tagged_ptr_ret.ww and trypromote.ww drop their local
`type nomem = !void;` aliases. 990_selfhost.c adds a regression that
a value named `nomem` does not collide with the predeclared type.
This commit is contained in:
@@ -440,6 +440,7 @@ extern Type *ty_int, *ty_uint, *ty_uintptr;
|
||||
extern Type *ty_f32, *ty_f64, *ty_str;
|
||||
extern Type *ty_err;
|
||||
extern Type *ty_never;
|
||||
extern Type *ty_nomem; /* task #29: predeclared `!void` alias */
|
||||
extern Type *ty_untyped_int, *ty_untyped_float, *ty_untyped_str;
|
||||
extern Type *ty_untyped_rune, *ty_untyped_bool, *ty_untyped_nil;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user