Phase 6 followup: fix #? reader conditional :default fallback

- reader.janet: read-reader-conditional now falls back to :default
  when :clj branch is not matched (iterates clauses a second time)
- test/phase6-test.janet: restore :default tests for #? and #?@
  (#? :default fallback, #?@ :default fallback) — all 6 assertions pass
This commit is contained in:
Yogthos 2026-06-02 22:00:08 -04:00
parent fbddf625b4
commit f410f5c48b
2 changed files with 12 additions and 0 deletions

View file

@ -19,6 +19,7 @@
(print "30: #? reader conditionals...")
(let [ctx (init)]
(assert (= :yes (ct-eval ctx "#?(:clj :yes :cljs :no)")) "#? selects :clj")
(assert (= :yes (ct-eval ctx "#?(:cljs :no :default :yes)")) "#? :default fallback")
(assert (= nil (ct-eval ctx "#?(:cljs :no)")) "#? nil on no match"))
(print " passed")
@ -26,6 +27,8 @@
(let [ctx (init)]
(assert (= [1 2 3] (ct-eval ctx "[#?@(:clj [1 2 3] :cljs [4 5 6])]"))
"#?@ splices :clj")
(assert (= [99] (ct-eval ctx "[#?@(:cljs [1] :default [99])]"))
"#?@ :default fallback")
(assert (= [] (ct-eval ctx "[#?@(:cljs [1 2])]"))
"#?@ nothing on no match"))
(print " passed")