Fix type tooltips for multiple values
This broke when I made the printing lazier using thunks. Also use regexps for the tooltip tests. original commit: 8bff995f41be53c119d4d09cb802b1f8c8f5c714
This commit is contained in:
parent
a42eaad1ca
commit
9243ac154c
|
@ -123,11 +123,11 @@
|
|||
(pretty-format-type (cleanup-type type))))]
|
||||
[(or (tc-results: types)
|
||||
(tc-results: types _ _ _ _)) ; FIXME, account for dty/dbound
|
||||
(apply string-append
|
||||
(for/list ([(type index) (in-indexed (in-list types))])
|
||||
(format "Value ~a:~n ~a~n"
|
||||
(add1 index)
|
||||
(printer-thunk type-names
|
||||
(printer-thunk type-names
|
||||
(apply string-append
|
||||
(for/list ([(type index) (in-indexed (in-list types))])
|
||||
(format "Value ~a:~n ~a~n"
|
||||
(add1 index)
|
||||
(pretty-format-type (cleanup-type type)
|
||||
#:indent 2)))))]
|
||||
[(tc-any-results: _) "AnyValues"]))
|
||||
|
|
|
@ -70,12 +70,12 @@
|
|||
(match-define (vector stx start* end* type*) tooltip)
|
||||
(printf "~a ~a ~a~n" start* end* (if (procedure? type*) (type*) type*))))
|
||||
(for/and ([entry (in-list lst)])
|
||||
(match-define (list type start end) entry)
|
||||
(match-define (list regex start end) entry)
|
||||
(for/or ([tooltip (in-list tooltips)])
|
||||
(match-define (vector stx start* end* type*) tooltip)
|
||||
(and (= start start*)
|
||||
(= end end*)
|
||||
(equal? type (if (procedure? type*) (type*) type*))))))
|
||||
(regexp-match? regex (if (procedure? type*) (type*) type*))))))
|
||||
|
||||
;; ensures there are no duplicate type tooltips for a single syntax location
|
||||
(define (unique-locations? tooltips)
|
||||
|
@ -90,9 +90,12 @@
|
|||
(define tests
|
||||
(test-suite "Tooltip tests"
|
||||
(check-tooltip (string-append "foo" "bar")
|
||||
(has-types-at? (list (list "String" 38 43))))
|
||||
(has-types-at? (list (list "^String$" 38 43))))
|
||||
(check-tooltip (for/list : (Listof Integer) ([i (list 1 2 3)]) i)
|
||||
(has-types-at? (list (list "(Listof Integer)" 23 24)
|
||||
(list "(Listof Integer)" 72 73))))
|
||||
(has-types-at? (list (list "^\\(Listof Integer\\)$" 23 24)
|
||||
(list "^\\(Listof Integer\\)$" 72 73))))
|
||||
(check-tooltip (class object% (super-new) (field [x : Integer 0]) x (set! x 3))
|
||||
(has-types-at? (list (list "Integer" 74 75))))))
|
||||
(has-types-at? (list (list "^Integer$" 74 75))))
|
||||
(check-tooltip (values 1 2)
|
||||
(has-types-at? (list (list #rx"Value 1:.*One.*Value 2:.*Positive-Byte"
|
||||
23 24))))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user