HS: block literals callable as zero-arg lambdas (+4 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s

Fix compiler: (block-literal () body) was emitting bare body instead of
(fn () body). Now always wraps in fn regardless of param count.
Generator: MANUAL_TEST_BODIES for all 4 blockLiteral tests using apply
and SX map rather than JS array.map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 15:53:29 +00:00
parent 8e8c2a73d6
commit 61c9697f67
4 changed files with 23 additions and 12 deletions

View File

@@ -3984,13 +3984,17 @@
;; ── expressions/blockLiteral (4 tests) ──
(defsuite "hs-upstream-expressions/blockLiteral"
(deftest "basic block literals work"
(error "SKIP (untranslated): basic block literals work"))
(assert= (apply (eval-expr-cek (hs-to-sx (hs-compile "\\ -> true"))) (list)) true)
)
(deftest "basic identity works"
(error "SKIP (untranslated): basic identity works"))
(assert= (apply (eval-expr-cek (hs-to-sx (hs-compile "\\ x -> x"))) (list true)) true)
)
(deftest "basic two arg identity works"
(error "SKIP (untranslated): basic two arg identity works"))
(assert= (apply (eval-expr-cek (hs-to-sx (hs-compile "\\ x, y -> y"))) (list false true)) true)
)
(deftest "can map an array"
(error "SKIP (untranslated): can map an array"))
(assert= (map (eval-expr-cek (hs-to-sx (hs-compile "\\ s -> s.length"))) (list "a" "ab" "abc")) (list 1 2 3))
)
)
;; ── expressions/boolean (2 tests) ──