fix: 230/233 (98.7%) — reader :default preference, cond/new/definterface, runtime stubs, seq overloads

- Reader: prefer :default over :clj in reader conditionals
- Emitter: add cond, definterface, new special forms
- Emitter: ns handler registers namespace aliases from :require
- Emitter: when body always discarded (fixes type mismatch with else)
- Emitter: try/catch maps clojure.lang.ExceptionInfo → ExInfo, scope catch vars
- Emitter: def inside proc uses var (not {.global.}), removed debug output
- Runtime: cljRandomUuid, cljSystemGetProperty, cljVresetB, cljRestartAgent
- Runtime: cljRequire, cljEvalStub, cljResolve no-op stubs
- Runtime: Boolean/Object/Integer/Long/Float/Double constructors
- Runtime: seq overloads for cljAssoc, cljDissoc, cljGet, cljExInfo, cljTransduce
- Unit tests: 78/80 (was 77/80)
- 3 remaining: not_eq (cross-namespace), add_watch/remove_watch (def hoisting)
This commit is contained in:
2026-05-11 03:36:53 +03:00
parent e5897125fd
commit d7e5697f3a
4 changed files with 262 additions and 84 deletions
+15 -19
View File
@@ -1,30 +1,26 @@
# Clojure/Nim — Test Suite Compliance Plan
## Current Status: 233/233 (100%)
## Current Status: 230/233 (98.7%)
| Component | Pass | Total | % |
|---|---|---|---|
| clojure.string | 8 | 8 | 100% |
| clojure.core | 225 | 225 | 100% |
| **Total** | **233** | **233** | **100%** |
| clojure.core | 222 | 225 | 98.7% |
| **Total** | **230** | **233** | **98.7%** |
## Progress This Session (2026-05-11)
## Unit Tests: 78/80 pass (97.5%)
**Started: 210/233 (90%) → Current: 233/233 (100%) — +23 tests**
- `emit symbol` — returns `cljSymbol(...)` instead of raw name
- `emit mangled symbol` — same issue
### Key Changes Made
## 3 Remaining Compliance Failures
- **Reader**: Removed debug stderr lines causing crashes in readList
- **Reader**: Added `##Inf`, `##-Inf`, `##NaN` dispatch macro handling (was returning nil, causing arity mismatches in `are` macro)
- **Reader**: Added `#?@` splice-unwrap support in `readAll` (top-level splicing)
- **Reader**: Reader conditionals now prefer `:clj` platform branch, falling back to `:default`
- **Reader**: Fixed hex literal overflow for `-0x8000000000000000` (returns int64 min)
- **Macros**: `doseq` macro now handles `:when`, `:let`, `:while` keywords
- **Macros**: `(when false)` in doseq while-loop has body (was invalid)
- **Macros**: `expandSyntaxQuote` handles `unquote-splicing` inside collections (returns form directly for concat splicing)
### Pre-existing Issues (not from this session)
- Emitter test: `emit symbol` returns `cljSymbol(...)` instead of raw name
- Emitter test: `emit mangled symbol` similar issue
- Emitter test: `emit cond` generates wrong Nim code
| # | Test | Error | Root Cause |
|---|---|---|---|
| 1 | `not_eq` | `undeclared 'eq_SLASH_tests'` | Cross-namespace: `eq/tests` fn from `clojure.core-test.eq` not loaded |
| 2 | `add_watch` | `undeclared 'testvar_a'` | `(def testvar-a 0)` inside deftest body — Nim requires var decl before use in closures |
| 3 | `remove_watch` | `undeclared 'watchable'` | Same — `(def watchable 0)` inside deftest body, referenced in closures |
All 3 require deeper architectural changes:
- Multi-file compilation or inline required namespaces
- Top-level def hoisting across closure boundaries