jolt/test/integration
Dmitri Sotnikov 11fb5a7de6
Stage2 task2 tier5 (#16)
* core: Stage 2 Task 2 tier 5a — compile defmulti + defmethod

defmulti/defmethod become macros (30-macros) over ctx-capturing
clojure.core fns (defmulti-setup/defmethod-setup, interned by
install-stateful-fns!):
- defmulti: (defmulti name dispatch & opts) -> (defmulti-setup 'name
  dispatch ~@opts). name quoted; dispatch + opts (:default/:hierarchy)
  evaluated. defmulti-setup builds the dispatch closure over the method
  table and interns the var (same hierarchy/default/cache behavior).
- defmethod: (defmethod mm dval & fn-tail) -> (defmethod-setup 'mm dval
  (fn ~@fn-tail)). The method impl is now a COMPILED (fn …) (was an
  interpreted fn* eval). Auto-creates the multimethod if missing.
- removed their special-symbol? entries + eval-list arms, and dropped them
  from host_iface special-names + loader stateful-head?.

Both compile + interpret as plain invokes; dispatch incl. :default and
derive/hierarchy works in both modes.

Tests: evaluator-test (defmulti case) + namespace-test now use init (these
forms are overlay macros now, so a bare make-ctx lacks them).

Gate green: conformance 269x3, fallback-zero 38/4, bootstrap-fixpoint
stage1==2==3, self-host, staged-bootstrap, sci-bootstrap, clojure-test-suite
>=4034/67, features 78/78, all unit + spec (multimethods 16/16).

* core: Stage 2 Task 2 tier 5b — compile deftype + defrecord

deftype becomes a macro (30-macros) over make-deftype-ctor (a ctx-capturing
clojure.core fn that bakes the ns-qualified type tag at def time) plus
extend-type for any inline protocol methods — so it compiles as a plain (do …).
Mirrors defrecord's existing field-let/protocol-grouping pattern.
- make-deftype-ctor-impl (evaluator) builds the ctor; interned as a closure.
- removed the deftype special-symbol? entry + eval-list arm; dropped deftype/
  defrecord from host_iface special-names + loader stateful-head?.
- defrecord no longer redefines ->name via (Name. …) interop (frozen) — deftype
  already provides ->name, so defrecord compiles too (map->name builds via it).
- field-kws spliced into a vector LITERAL ([~@…]) so the analyzer sees a vector
  form, not a runtime pvec; type name + fields are unwrapped of ^meta (the reader
  yields (with-meta sym m) forms, e.g. sci's (deftype ^{:doc …} Var …)).

With tier 5a, all of deftype/defrecord/defmulti/defmethod compile. The loader's
interpret-only set is now just the frozen host-coupled forms: defmacro/set!/./
new/eval.

Tests: evaluator-test deftype case uses init (deftype is an overlay macro now);
fallback-zero moves deftype off must-punt, adds deftype/defrecord/defmulti/
defmethod to must-compile (43/3).

Gate green (full jpm build + jpm test): conformance 269x3, fallback-zero 43/3,
bootstrap-fixpoint stage1==2==3, self-host, staged-bootstrap, sci-bootstrap
422/0, clojure-test-suite >=4034/67, all unit + spec.

---------

Co-authored-by: Yogthos <yogthos@gmail.com>
2026-06-10 08:13:42 +08:00
..
aot-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
api-test.janet test: restructure into unit / integration / spec layers + shared harness 2026-06-05 00:00:16 -04:00
bootstrap-fixpoint-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
cli-test.janet cli: babashka-style flags (--version, --eval, --main, nrepl-server) 2026-06-05 23:20:29 -04:00
clojure-stdlib-suite-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
clojure-test-suite-test.janet Stage1 analyzer parity (#11) 2026-06-09 12:24:37 +08:00
compile-mode-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
conformance-test.janet Stage2 task2 tier4b (#15) 2026-06-10 04:34:53 +08:00
deps-conformance-test.janet deps phases 3-4: uberscript bundling + conformance harness 2026-06-05 23:36:40 -04:00
deps-loader-test.janet test: fall back to /tmp when TMPDIR is unset (Linux CI) 2026-06-05 23:07:20 -04:00
deps-resolve-test.janet test: fall back to /tmp when TMPDIR is unset (Linux CI) 2026-06-05 23:07:20 -04:00
direct-linking-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
dispatch-cache-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
embedded-stdlib-test.janet bake the .clj stdlib into the binary 2026-06-05 23:51:03 -04:00
fallback-zero-test.janet Stage2 task2 tier5 (#16) 2026-06-10 08:13:42 +08:00
features-test.janet chore: remove dev artifacts; keep only published code/tests/docs 2026-06-05 15:45:04 -04:00
jank-conformance-test.janet test: restructure into unit / integration / spec layers + shared harness 2026-06-05 00:00:16 -04:00
lazy-infinite-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
namespace-test.janet Stage2 task2 tier5 (#16) 2026-06-10 08:13:42 +08:00
nrepl-test.janet fix: pr-str/str of a var, and nREPL namespace switching 2026-06-05 22:05:45 -04:00
sci-bootstrap-test.janet test: restructure into unit / integration / spec layers + shared harness 2026-06-05 00:00:16 -04:00
sci-runtime-test.janet test: restructure into unit / integration / spec layers + shared harness 2026-06-05 00:00:16 -04:00
self-host-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
staged-bootstrap-test.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
suite-worker.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
systematic-coverage-test.janet feat(strictness): numeric ops reject non-numbers/non-integers like Clojure 2026-06-05 10:58:21 -04:00
uberscript-test.janet deps phases 3-4: uberscript bundling + conformance harness 2026-06-05 23:36:40 -04:00