cs & io: fix ellipses printing in structs that are partially opaque

This commit is contained in:
Matthew Flatt 2019-11-26 09:17:02 -07:00
parent 98f0c16b8c
commit 0e87b8a73f
2 changed files with 12 additions and 1 deletions

View File

@ -442,6 +442,15 @@
(struct s () #:transparent)
(define x (s)) ; a shared value to use in the test
(struct s+ (v) #:transparent)
(struct sub s+ ())
(test-print/all (sub '(x))
"#(struct:sub (x) ...)"
"#(struct:sub (x) ...)"
"#(struct:sub (x) ...)"
"(sub '(x) ...)"
"#(struct:sub (x) ...)")
(parameterize ([print-graph #t])
(for*/parameterize ([print-pair-curly-braces (in-list '(#t #f))]
[print-mpair-curly-braces (in-list '(#t #f))])

View File

@ -306,7 +306,7 @@
(config-get config print-struct))
(cond
[(eq? mode PRINT-MODE/UNQUOTED)
(define l (vector->list (struct->vector v)))
(define l (vector->list (struct->vector v struct-dots)))
(define alt-list-constructor
;; strip "struct:" from the first element of `l`:
(string-append "(" (substring (symbol->string (car l)) 7)))
@ -350,3 +350,5 @@
(when (and (eq? mode WRITE-MODE)
(not (config-get config print-unreadable)))
(fail-unreadable who v)))
(define struct-dots (unquoted-printing-string "..."))