lib: retire os.assert/abort shims — assert/abort are builtins (#58 respell)
The flat checker scope makes ANY decl named assert/abort anywhere in the combined unit disable the builtin unit-wide (the #45 shadow shape: scope_lookup_prefer's cross-module fallback finds it). lib carried three colliding @symbol("rt_abort") shims (os, time, strconv/stof) plus the os.assert wrapper, so a bare assert(cond) in ANY program importing os mis-bound os.assert and failed arity — a hard blocker for regex fold-5 (regex.ha:660/670 bring builtin-assert mass). Ruled respell-now per the recurrence test (#45 -> #58). Delete the shims and the os.assert wrapper; every bare abort(msg) caller (regex, strings, utf8, hash, getopt, encoding/*, time, stof) now lands on the builtin, and the ~40 os.assert(c, m) sites respell to the builtin assert(c, m) — restoring the exact Hare spelling the lib ports diverged from (e.g. ref/hare/bytes/tokenize.ha:23). os.assert had no Hare counterpart (Hare's assert is a language builtin); rule-9 wrapper removed. temp/dirs/bufio already use the non-colliding rtabort spelling and keep it. Now-dead 'import os;' lines kept (pre-existing precedent: lib/strconv/strconv.ww carries one); a tree-wide dead-import sweep is a separate concern. regex.ww's if+abort workarounds citing #58 stay for the fold-5 owner to fold back into assert. combined.ww regenerated for all five selfhost tools + the smoke fixture via make.
This commit is contained in:
@@ -97,8 +97,6 @@ fn todig(c: u8) u8 = {
|
||||
return 0u8; // unreachable; rt_abort is void-typed (path-cov)
|
||||
};
|
||||
|
||||
@symbol("rt_abort") fn abort(msg: str) void;
|
||||
|
||||
// ref/hare/strconv/stof.ha:25.
|
||||
type fast_parsed_float = struct {
|
||||
mantissa: u64,
|
||||
@@ -280,7 +278,7 @@ fn decimal_parse(d: *decimal, s: str) (void | invalid) = {
|
||||
|
||||
// ref/hare/strconv/stof.ha:173. Count of leading zero bits in n>0.
|
||||
fn leading_zeroes(n: u64) uint = {
|
||||
os.assert(n > 0u64, "strconv.leading_zeroes: n == 0");
|
||||
assert(n > 0u64, "strconv.leading_zeroes: n == 0");
|
||||
let b: u64 = 0u64;
|
||||
if ((n & 0xFFFFFFFF00000000u64) > 0u64) {
|
||||
n >>= 32u64;
|
||||
@@ -599,7 +597,7 @@ export fn stof64(s: str, b: base) (f64 | invalid | overflow) = {
|
||||
} else if (bb == base.HEX_LOWER) {
|
||||
bb = base.HEX;
|
||||
};
|
||||
os.assert(bb == base.DEC || bb == base.HEX,
|
||||
assert(bb == base.DEC || bb == base.HEX,
|
||||
"strconv.stof64: base must be DEC or HEX");
|
||||
|
||||
if (s.len == 0) {
|
||||
@@ -652,7 +650,7 @@ export fn stof32(s: str, b: base) (f32 | invalid | overflow) = {
|
||||
} else if (bb == base.HEX_LOWER) {
|
||||
bb = base.HEX;
|
||||
};
|
||||
os.assert(bb == base.DEC || bb == base.HEX,
|
||||
assert(bb == base.DEC || bb == base.HEX,
|
||||
"strconv.stof32: base must be DEC or HEX");
|
||||
|
||||
if (s.len == 0) {
|
||||
|
||||
Reference in New Issue
Block a user