summaryrefslogtreecommitdiffstats
path: root/tests/012/op.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-29 21:52:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-29 21:52:46 -0700
commit0de65a6edc3631ce50ad5f5082ff82a45be867d0 (patch)
treebe3c77edbd0f42d87f254f7c5e9433477d6336ea /tests/012/op.tl
parent05500916c74317905fb6f75088f50606a9b562af (diff)
downloadtxr-0de65a6edc3631ce50ad5f5082ff82a45be867d0.tar.gz
txr-0de65a6edc3631ce50ad5f5082ff82a45be867d0.tar.bz2
txr-0de65a6edc3631ce50ad5f5082ff82a45be867d0.zip
op: bug in do: must insert @1 into unexpanded form.
In the case when the do syntax has no metavariables, and it expands as-is without the addition of symbol in the tail position, we are doing something wrong: we are adding the @1 into the expanded version of the form, rather than the original. For instance: 1> (expand '(do pop a)) (lambda (#:arg-1-0017 . #:arg-rest-0016) (prog1 (car a) (sys:setq a (cdr a)) #:arg-1-0017)) Here, the @1 was inserted into the (prog1 ...) form which is the expansion of pop. This is incorrect; it must be inserted into the original (pop a) syntax as (pop a @1). * op.tl (op-expand): In this case when there are no metas and no do-gen that can be replaced by @1 via symacrolet, go back to the original args syntax, add the arg1 meta into that syntax, and process it from the beginning through parallel expansions steps. * tests/012/op.tl: Couple of tests added.
Diffstat (limited to 'tests/012/op.tl')
-rw-r--r--tests/012/op.tl5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/012/op.tl b/tests/012/op.tl
index 0fffb6ee..12969dcc 100644
--- a/tests/012/op.tl
+++ b/tests/012/op.tl
@@ -40,6 +40,11 @@
(fi (do if @42 @rest)) (42 t)
(fi (do if @1 @3 @rest @2)) (3 t))
+(mtest
+ [(do quote x) 3] :error
+ [(do quote @1) 3] :error
+ (do pop a) :error)
+
(defun y (f)
[(op @1 @1)
(op f (op [@@1 @@1]))])