aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/macros-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-09-02 20:05:40 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-09-02 20:05:40 -0700
commit112ce5291da35e54c38c4ff1d7a2408a64a98e71 (patch)
treeecb4b83087e917fe213bb099556f42c9fccecbeb /lib/csc/macros-test.csc
parentUndo the hacky list constant changes. (diff)
downloadchromatopelma-112ce5291da35e54c38c4ff1d7a2408a64a98e71.tar.zst
Fix bugs with recursive macros and empty template.
Diffstat (limited to 'lib/csc/macros-test.csc')
-rw-r--r--lib/csc/macros-test.csc19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/csc/macros-test.csc b/lib/csc/macros-test.csc
index cce95ac..9c4aced 100644
--- a/lib/csc/macros-test.csc
+++ b/lib/csc/macros-test.csc
@@ -255,6 +255,25 @@
transform-ir1))
+ (test builtin-syntax-rules-recursive
+ (assert-equal
+ (make-call-builtin 'add
+ (list (make-constant 1)
+ (make-call-builtin 'add
+ (list (make-constant 1)
+ (make-call-builtin 'add (list (make-constant 1) (make-constant 0)))))))
+ (expand-body 'main
+ '((let-syntax
+ ((macro-len
+ (syntax-rules ()
+ ((macro-len ()) 0)
+ ((macro-len (_ tail ...))
+ (call-builtin add 1 (macro-len (tail ...)))))))
+ (macro-len (a b c))))
+ builtins-environment)
+ transform-ir1))
+
+
(define (test-ref sym)
(make-lexical-ref sym (gensym)))