diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-31 13:07:06 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-31 13:07:06 -0700 |
commit | 0b4a373f69bf7e4684f03d622ee0c1f3be8e8df5 (patch) | |
tree | 75bfd519115bf59c59cd7638c382ef3672b40ac5 /tests/012/oop.tl | |
parent | b6983a3098d26727b9ca81a37c58cc01cef51341 (diff) | |
download | txr-0b4a373f69bf7e4684f03d622ee0c1f3be8e8df5.tar.gz txr-0b4a373f69bf7e4684f03d622ee0c1f3be8e8df5.tar.bz2 txr-0b4a373f69bf7e4684f03d622ee0c1f3be8e8df5.zip |
oop: fix infelicity in new* and lnew* macros.
* stdlib/struct.tl (sys:new-expander): If the argument of
new* or lnew* is dwim, then treat that as an expression,
rather than as a boa-style construction.
* tests/012/oop.tl: Tests for new* focusing on this issue.
* txr.1: Documented.
Diffstat (limited to 'tests/012/oop.tl')
-rw-r--r-- | tests/012/oop.tl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/012/oop.tl b/tests/012/oop.tl index ac93790f..e9c256b8 100644 --- a/tests/012/oop.tl +++ b/tests/012/oop.tl @@ -77,3 +77,17 @@ (prinl d) (prinl (list b.sa b.sb b.sc b.x b.y)) (prinl (list d.sa d.sb d.sc d.x d.y))) + +(defstruct (ab a : b) () a b) + +(mtest + (new* (find-struct-type 'ab) a 1) :error + (new* ((find-struct-type 'ab)) a 1) #S(ab a 1 b nil) + (new* [find-struct-type 'ab] a 1) #S(ab a 1 b nil) + (new* ([find-struct-type 'ab] 1 2)) #S(ab a 1 b 2) + (new* ((find-struct-type 'ab) 1 2)) #S(ab a 1 b 2) + (new* ([find-struct-type 'ab] 1) b 2) #S(ab a 1 b 2) + (let ((type (find-struct-type 'ab))) + (new* type a 3 b 4)) #S(ab a 3 b 4) + (let ((type (find-struct-type 'ab))) + (new* (type 3 4))) #S(ab a 3 b 4)) |