diff --git a/examples/0714-modules-json-reader.sx b/examples/0714-modules-json-reader.sx index 2197638..f7e1b79 100644 --- a/examples/0714-modules-json-reader.sx +++ b/examples/0714-modules-json-reader.sx @@ -30,13 +30,9 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -// Half-open containment [lo, hi). Written with early returns (no `and`) so -// the assertions below never combine comparisons with short-circuit -// `and`/`or` — see issues/0078. +// Half-open containment [lo, hi). in_range :: (x: s64, lo: s64, hi: s64) -> bool { - if x < lo { return false; } - if x >= hi { return false; } - return true; + return x >= lo and x < hi; } // True when `parse(src)` raised `want` — destructure captures the error @@ -74,12 +70,10 @@ main :: () -> ! { is_null := if o.items[4].val == { case .null_: true; else: false; }; report("null-value", is_null); - // Two separate reports (not `key=="k" and val=="v"`): a string `==` - // as an operand of short-circuit `and`/`or` miscompiles — see - // issues/0078. Every assertion here is therefore a single comparison. + // The nested pair asserted as one expression — a string `==` on each + // side of `and`. sub := o.items[5].val.object; - report("nested-key", sub.items[0].key == "k"); - report("nested-val", sub.items[0].val.str == "v"); + report("nested-pair", sub.items[0].key == "k" and sub.items[0].val.str == "v"); // ── 2. Heap discipline: view vs decoded ────────────────────────── base : s64 = xx src.ptr; @@ -96,7 +90,6 @@ main :: () -> ! { report("round-trip", rt == src); // ── 4. Leading/trailing/inner whitespace is insignificant ──────── - // Each comparison is its own report (no `and`-combining — issues/0078). wsv := try parse(" [ 1 , 2 , 3 ] ", xx arena); wa := wsv.array; report("ws-count", wa.len == 3); diff --git a/examples/expected/0714-modules-json-reader.stdout b/examples/expected/0714-modules-json-reader.stdout index 796b0a9..fb03da7 100644 --- a/examples/expected/0714-modules-json-reader.stdout +++ b/examples/expected/0714-modules-json-reader.stdout @@ -8,8 +8,7 @@ array-pos: ok array-neg: ok bool-value: ok null-value: ok -nested-key: ok -nested-val: ok +nested-pair: ok plain-is-view: ok escaped-allocated: ok round-trip: ok