diff --git a/web/examples/quotes.sh b/web/examples/quotes.sh index b7320be..ee3126a 100644 --- a/web/examples/quotes.sh +++ b/web/examples/quotes.sh @@ -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"