Chez Phase 1 (increment 3f): quoted literals
Emit a :quote node by reconstructing the raw reader form as RT constructor calls: symbol -> jolt-symbol, list (array) -> jolt-list, vector (tuple) -> jolt-vector, map -> jolt-hash-map, set -> jolt-hash-set, scalars via emit-const. The runtime value of a quote is just that literal data (the interpreter returns the reader form verbatim). Quote exposed a latent seq.ss bug: empty map/filter results were jolt-nil, but Clojure's (map f []) is an empty seq, so (= () (map f [])) must be true. Return jolt-empty-list (which seqs back to nil, so it's still a valid lazy-tail terminator) instead — matching jolt-take/drop/rest/list. Prelude emit reach 334 -> 342/355. Subset probe 632 -> 664/664 compiled, 0 divergences (quote + the seq fix pull 32 corpus cases into the subset). emit-test 110/110 (added 16 quote cases). corpus.edn regenerated (the 3 malformed-catch spec rows). Full gate green.
This commit is contained in:
parent
d35783bf1b
commit
930800f9a6
6 changed files with 81 additions and 19 deletions
|
|
@ -152,6 +152,9 @@
|
|||
{:suite "exceptions / try-catch" :label "finally runs on ok" :expected "2" :actual "(let [a (atom 0)] (try 2 (finally (reset! a 9))) )"}
|
||||
{:suite "exceptions / try-catch" :label "finally runs on throw" :expected "9" :actual "(let [a (atom 0)] (try (throw (ex-info \"x\" {})) (catch :default e nil) (finally (reset! a 9))) @a)"}
|
||||
{:suite "exceptions / try-catch" :label "catch value of body" :expected "5" :actual "(try (+ 2 3) (catch :default e 0))"}
|
||||
{:suite "exceptions / try-catch" :label "malformed catch: non-symbol binding" :expected :throws :actual "(try 1 (catch e (* e 10)))"}
|
||||
{:suite "exceptions / try-catch" :label "malformed catch: literal binding" :expected :throws :actual "(try 1 (catch e 5))"}
|
||||
{:suite "exceptions / try-catch" :label "malformed catch: too short" :expected :throws :actual "(try 1 (catch Exception))"}
|
||||
{:suite "exceptions / assert" :label "assert true -> ok" :expected ":ok" :actual "(do (assert true) :ok)"}
|
||||
{:suite "exceptions / assert" :label "assert expr -> ok" :expected ":ok" :actual "(do (assert (= 1 1)) :ok)"}
|
||||
{:suite "exceptions / assert" :label "assert false throws" :expected :throws :actual "(assert false)"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue