Three quote probes compared a caret excerpt against a page that quotes one line

quotes.sh had been red since the compiler's diagnostics grew a source excerpt: the
needle swallowed the caret lines, so result, quoted and i64index failed against a
page that is in fact correct. It now compares the message and nothing else.

Six other probes are deleted rather than fixed. Vec, Map, Handle, an Fn-typed
parameter, a defer inside a let and break were all refused as not-implemented when
the loop was written; all six work today and the page's table lost their rows as
each landed, so the probes were the last thing in the tree asserting a claim the
page no longer makes. What made this invisible for weeks is worth recording: flan
check answers a program that compiles with its whole symbol table, so each of those
probes failed by printing eighty lines of prelude signatures. A clean exit is now
its own one-line failure saying the page's claim has gone stale.
This commit is contained in:
Joseph Ferano 2026-09-14 10:19:18 +07:00
parent 066322c47d
commit a003073be7

View File

@ -47,22 +47,39 @@ want "sand hash" "$("$FLAN" run "$root/test/programs/sand-headless.flan")"
want "run --target" "$("$FLAN" run "$here/hello.flan" --target=wasm32-wasi 2>&1)"
# The refusal and diagnostic messages quoted in the prose and in the
# "Not implemented yet" table.
# "Not implemented yet" table. Each is a program the compiler must reject, and
# what is compared is the first line of the rejection -- the message itself.
# Not the whole of what `flan check` prints: it grew a source excerpt with a
# caret under the offending form, and a needle that swallowed the excerpt was
# comparing three lines against a page that quotes one.
#
# Six probes that used to live here are gone, and it is worth saying why rather
# than leaving the next reader to wonder what the list once covered. (Vec T),
# (Map K V), (Handle T), an (Fn ...) parameter, a defer inside a let, and break
# were each refused as "not implemented yet" when this loop was written. All six
# work now, the page's table lost their rows as they landed, and the probes were
# the only thing left asserting a claim nobody makes any more. A probe for a
# refusal that no longer happens cannot go green, and keeping it would have meant
# a permanently red script -- which is the same as no script at all.
for pair in \
'vec:(defvar xs (Vec i32))' \
'map:(defvar m (Map string i32))' \
'result:(defn f [] (Result i32 i32) None)' \
'handle:(defvar h (Handle i32))' \
'fnty:(defn f [g (Fn [i32] i32)] i32 (g 1))' \
'quoted:(defn f [] i32 (quote a))' \
'deferblock:(defn f [] i32 (let [x 1] (defer (println "a")) x))' \
'i64index:(defconst xs [3 i32] [1 2 3]) (defn main [] i32 (let [i (i64 1)] (at xs i)))' \
'break:(defn main [] (let [i 0] (while (< i 3) (break))))'
'i64index:(defconst xs [3 i32] [1 2 3]) (defn main [] i32 (let [i (i64 1)] (at xs i)))'
do
name=${pair%%:*}; src=${pair#*:}
printf '%s\n' "$src" > "$here/.q.flan"
msg=$("$FLAN" check "$here/.q.flan" 2>&1 | sed 's/^[^ ]*: //')
want "message: $name" "$msg"
out=$("$FLAN" check "$here/.q.flan" 2>&1)
# A probe that compiles is the failure this loop is most likely to meet, and
# it is the one that used to be unreadable: `flan check` answers a clean
# program with its whole symbol table, so the needle became eighty lines of
# prelude signatures and the diff said nothing. Say what actually happened.
if "$FLAN" check "$here/.q.flan" >/dev/null 2>&1; then
echo "FAIL message: $name"
echo " this program compiles now — the page still says it is refused"
fail=1
continue
fi
want "message: $name" "$(printf '%s\n' "$out" | sed 's/^[^ ]*: //' | sed -n 1p)"
done
rm -f "$here/.q.flan"