Skip to content

Latest commit

 

History

History
167 lines (155 loc) · 10.1 KB

BUGS.md

File metadata and controls

167 lines (155 loc) · 10.1 KB

Bugs

Defects found in the implementation, for the owner to get to. Written by Claude sessions; each entry says how it was reproduced, and nothing here is a design decision. Remove an entry when it is fixed.

  1. A tail mark is refused in a function whose returns are all erased. With g : (unique (Nat) x) -> (unique (Nat) r at x), the body (let ((unique y)) (tail (g x))) (Zero) of a function returning (erased (Nat) e) is refused as not in tail position: project_code short-circuits on an empty list of kept results, so the trailing erased code never becomes (values) for check_marks to fold. Such a function is only ever called erased, so nothing runs wrongly.

  2. self/eval.sl answers a failed step with an ordinary value. Audit 2026-10-07 A2 and A3 (audit/2026-10-07-audit.md and its reproducers under audit/2026-10-07/, in the tree at aa84d4e) are two instances. A survey of self/eval.sl and self/heap.sl at f9d57e1 (read from the code; beyond A2/A3, none of the cases below was reproduced) found the same shape in several places, in three groups:

    • Fuel. No longer a fixed 1000000: flatten-value seeds rope-walk with twice the store's allocation count (store-size; the rope pair spends two units per level), ErListToArray seeds list-refs with the count itself, and running out becomes a BError ("out of fuel") rather than REmpty or Nil. With that, A2's and A3's reproducers match the reference under --interpret and compiled, under ulimit -s unlimited (at the default 8 MB stack, slc overflows on them before and after); no test was added yet. That the count suffices on an acyclic heap is an informal pigeonhole argument, not a proof. Nothing at the meta level excludes a cycle (store-write stores a body over the whole current history, and CCellWrite writes BTag blocks). On one, the report is an error block, with the limits of the third group below.
    • A block of the wrong shape, or a missing argument. rope-walk returns REmpty on a block that is neither BTag nor a string/char BExt. list-refs and ctor-fields return Nil on a non-BTag. heap-str returns SNil, field-nat returns 0, and apply-extern's na/nb/sa/sb default to 0 or SNil on a missing argument. ExFlatten gives SNil on a missing argument, and ErListToArray, ErArrayMake, ErArrayCopy, ErArraySub and ErArrayBlit build from Nil when array-fields or the argument is missing. ErWrite and ErArrayBlit keep the store unchanged on a list-nth miss. Well-typed input may never reach these; nothing in the evaluator shows that.
    • Error blocks that don't stop evaluation. Where the evaluator does report (error-vals, out of fuel included, and array-construct and apply-array-change), the report is a BError value. It becomes a runtime error: only when read as a final or a request, applied (apply's BError case), or emitted (failwith). As read, dispatch returns None for a BError scrutinee, and CMatch's None path then runs the first branch over ctor-fields of the error block, so a matched error might turn into an ordinary result. A dropped one disappears. Separately, apply-extern's fallback for an extern with no implementation of its own reports through ErPayload $ PStr "...", which seems to allocate a string BExt rather than a BError.

    A likely structural fix, not decided: give the evaluator's results a Result-shaped type, i.e. a failure with its message or the values. Each helper above would return that type, and eval and its mutual group would short-circuit on a failure at every step, making exhaustion and shape mismatches impossible to answer with an ordinary value. The BError block would then remain only as the emitted representation, if anywhere. Cheaper partial alternatives are a BError that dispatch and every block-inspecting helper propagate (each site an obligation, and a missed one keeps the bug), or a host-level abort primitive, which would be a design addition. Separately, the acyclicity a measure-based traversal would need is a question about heap.sl's store invariant.

  3. The compilers run a final value that is not in the last file at different times. The reference runs a file's final value as soon as it reaches it, before reading the files after it on the command line; slc, compiled or under --interpret, elaborates every file first and runs the finals afterwards. Reproduced with two files: a.sl ending in a Program that writes to stderr and exits with 0, and b.sl holding only a compile-warn. The reference writes the program's line and never reads b.sl, so it gives no warning; slc writes the warning, then the program's line. With a final that does not exit, the reference's warnings from later files would follow the program's output instead of preceding it. No test has this shape; self/bootstrap.sh compares each side's whole stderr, warnings included, so one that did would fail there. Which order is wanted is not decided here.

  4. The two compilers disagree on a let of a constant before a delegate call. In a function f at g whose body is (let ((many s)) (settled-of many g)) (delegate (g ...)), the reference refuses the delegate as not in tail position, and slc, compiled or under --interpret, accepts it. (cell-same u u) in place of the settled-of splits the same way. The reference's normalizer folds away a let of constants only when its right-hand side is a values of constants, and both forms compile to a bare constant; slc's folding appears to cover that case. DESIGN.md §19 says a delegate-bodied function is nothing but the call once lets that only rename are resolved away, which seems not to settle a let of a constant. Which answer is wanted is not decided here. No test has this shape.

  5. slc refuses a tail call returned beside an at entry. With f returning (unique (World) w2 at w) (many (Nat) n) and g returning (many (Nat) n), both in one def-fns block, the body (values w (tail $ g rest)) of f is accepted by the reference and refused by slc as "a tail-marked call is not in tail position", on origin/main as of e6ebf28 and after 5da2b75; the same holds with (many (Nat) j at k) in place of the world. The reference drops an at entry from the returns before judging tail position (DESIGN.md §19, §36); slc's tails-ok and call-report appear to see a values form of two entries and treat every entry as non-tail. No test has this shape; open-contradicts in self/elab-main.sl takes and returns the macro world so that elab-refute avoids it.

  6. Checking is exponential in a term's sharing. Canonical forms are expanded in full and walked as trees, so the cost seems to track the expanded size, not the source. Reproduced with n lets (let ((erased x{i+1})) (Node x{i} x{i}))) in a function body: the reference takes 6.8 s and 301 MB at n=20 and times out at n=22; slc overflows its stack at n=18 (3.1 s and 196 MB under ulimit -s unlimited). An unshared chain stays flat, even 1000 deep. The same growth was seen at many, in run position, through a call's is return, and with the chain then matched, is-checked, used as a type index, or given to prove-subterm. A failing prove-subterm is worst, since its message prints the expanded term (22 s and 5.2 MB at n=18). Memoizing canon alone (not committed) left the time exponential in fold_vars and unify, so a fix probably has to make every term walk sharing-aware, in both compilers.

  7. slc and the reference word two refusals differently. A refuted branch in a run-position match gets "omit it or write (absurd Zero)" at column 45 from the reference and "omit it or write absurd" at column 44 from slc (proposals/self-formal/proto/aftererr/17_type_error_first.sl on the branch claude/confident-hamilton-ug3l7r, line 2). A macro whose run crashes, proposals/self-formal/proto/review8/bugs_macro_crash.sl there under --eval-fuel 100, gets "macro m failed: out of fuel" from the reference and "compile-time evaluation failed: out of fuel" from slc, at the same position. Reproduced at f348279d.

  8. slc --interpret cuts a long list in a request short. heap-strs, heap-pairs, and heap-jobs in self/eval.sl, which read the lists a ConfinePaths or Exec request carries, take a fixed fuel of 1000000 and answer running out with Nil, so a longer list seems to be cut short with no report. With proposals/self-formal/proto/bugs/heap_strs_cut.sl on the branch claude/confident-hamilton-ug3l7r (a reads list of 1000000 entries "absent-dir" then ".", then a Stat "."), under ulimit -s unlimited, slc --interpret prints confine ok and stat cwd refused, where the reference and the binary slc --build makes print stat cwd ok. Exec's lists were not tried. This seems to conflict with DESIGN.md §31's "A crash produces no value, never a different one". Reproduced at 81c534a9.

  9. The compilers differ in acceptance when a later file fails. With proposals/self-formal/proto/review5/01_prog_first.sl on the branch claude/confident-hamilton-ug3l7r, whose Program writes effect and exits 0, followed on the command line by proposals/self-formal/proto/review5/01_late_error.sl there (a compile-error), the reference writes effect and exits 0, reporting nothing about the second file, while slc, compiled or under --interpret, reports the second file's error and exits 1 without running the Program. This follows from entry 19's difference in when a final value runs. Reproduced at f348279d.