Add a #:verbose option to :type.
This prints the old way, expanding all aliases inside the type.
(cherry picked from commit 1f5b262f6d
)
This commit is contained in:
parent
b35e0fd138
commit
6e94295c96
|
@ -21,3 +21,16 @@
|
||||||
(tr-eval '(:type Bar))
|
(tr-eval '(:type Bar))
|
||||||
|
|
||||||
(check-equal? (get-output-string out) "(U Integer String)\n(Foo -> Foo)\n")
|
(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
|
(syntax-parse stx
|
||||||
[(_ . ((~datum module) . rest))
|
[(_ . ((~datum module) . rest))
|
||||||
#'(module . rest)]
|
#'(module . rest)]
|
||||||
[(_ . ((~literal :type) ty:expr))
|
[(_ . ((~literal :type)
|
||||||
(parameterize ([current-print-type-fuel 1])
|
(~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))))]
|
#`(display #,(format "~a\n" (parse-type #'ty))))]
|
||||||
;; Prints the _entire_ type. May be quite large.
|
;; Prints the _entire_ type. May be quite large.
|
||||||
[(_ . ((~literal :print-type) e:expr))
|
[(_ . ((~literal :print-type) e:expr))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user