diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-03-23 00:55:46 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-03-23 00:55:46 -0700 |
commit | c6a32a5aafa0b85318ef1262f464ba270e3da71c (patch) | |
tree | 162771f2a6561901078cc6cc12b88e5be3f4fecb /lib.c | |
parent | 0d8638e43da65169c3d46273c6c9c8239f54723f (diff) | |
download | txr-c6a32a5aafa0b85318ef1262f464ba270e3da71c.tar.gz txr-c6a32a5aafa0b85318ef1262f464ba270e3da71c.tar.bz2 txr-c6a32a5aafa0b85318ef1262f464ba270e3da71c.zip |
printer: [] shouldn't print as [. nil].
* lib.c (obj_print_impl): In the case when dwim
has no args, and the logic short circuits to
a closing brace, bypassing the loop, we should
only use the dot notation if the terminating
atom is other than nil.
* tests/012/readprint.tl: Tests added.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -14349,8 +14349,10 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx) if (sym == dwim_s) { put_char(chr('['), out); if (!have_args) { - put_string(lit(". "), out); - obj_print_impl(args, out, pretty, ctx); + if (args) { + put_string(lit(". "), out); + obj_print_impl(args, out, pretty, ctx); + } put_char(chr(']'), out); break; } |