Add a #:verbose option to :type.
This prints the old way, expanding all aliases inside the type.
This commit is contained in:
parent
fd33584b6f
commit
1f5b262f6d
|
@ -21,3 +21,16 @@
|
|||
(tr-eval '(:type Bar))
|
||||
|
||||
(check-equal? (get-output-string out) "(U Integer String)\n(Foo -> Foo)\n")
|
||||
|
||||
;; if #:verbose, make sure it's the full type
|
||||
(tr-eval '(:type #:verbose Bar))
|
||||
(check-equal? (get-output-string out)
|
||||
(string-append "(U Integer String)\n(Foo -> Foo)\n"
|
||||
"((U 0 1 Byte-Larger-Than-One Positive-Index-Not-Byte "
|
||||
"Positive-Fixnum-Not-Index Negative-Fixnum "
|
||||
"Positive-Integer-Not-Fixnum Negative-Integer-Not-Fixnum String) "
|
||||
"-> (U 0 1 Byte-Larger-Than-One Positive-Index-Not-Byte "
|
||||
"Positive-Fixnum-Not-Index Negative-Fixnum "
|
||||
"Positive-Integer-Not-Fixnum Negative-Integer-Not-Fixnum "
|
||||
"String))\n"))
|
||||
|
||||
|
|
|
@ -53,8 +53,16 @@
|
|||
(syntax-parse stx
|
||||
[(_ . ((~datum module) . rest))
|
||||
#'(module . rest)]
|
||||
[(_ . ((~literal :type) ty:expr))
|
||||
(parameterize ([current-print-type-fuel 1])
|
||||
[(_ . ((~literal :type)
|
||||
(~optional (~and #:verbose verbose-kw))
|
||||
ty:expr))
|
||||
(parameterize ([current-print-type-fuel
|
||||
(if (attribute verbose-kw) +inf.0 1)]
|
||||
;; This makes sure unions are totally flat for the
|
||||
;; infinite fuel case. If fuel that's not 0, 1, or +inf.0
|
||||
;; is ever used, more may need to be done.
|
||||
[current-type-names
|
||||
(if (attribute verbose-kw) '() (current-type-names))])
|
||||
#`(display #,(format "~a\n" (parse-type #'ty))))]
|
||||
;; Prints the _entire_ type. May be quite large.
|
||||
[(_ . ((~literal :print-type) e:expr))
|
||||
|
|
Loading…
Reference in New Issue
Block a user