Update type-table after tc-funapp processing
This makes the tooltip show the more refined function type after application typechecking. For example, case-> types will be narrowed to the particular case that fits. Polymorphic function types will be instantiated at the appropriate type. Fixes issue #325
This commit is contained in:
parent
cffad4df74
commit
9ec358b665
|
@ -7,7 +7,7 @@
|
|||
(typecheck check-below tc-subst tc-metafunctions possible-domains)
|
||||
(utils tc-utils)
|
||||
(rep type-rep filter-rep)
|
||||
(except-in (types utils abbrev subtype)
|
||||
(except-in (types utils abbrev subtype type-table)
|
||||
-> ->* one-of/c))
|
||||
(require-for-cond-contract
|
||||
syntax/stx)
|
||||
|
@ -18,6 +18,8 @@
|
|||
(#:check boolean?)
|
||||
. ->* . full-tc-results/c)])
|
||||
(define (tc/funapp1 f-stx args-stx ftype0 argtys expected #:check [check? #t])
|
||||
;; update tooltip-table with inferred function type
|
||||
(add-typeof-expr f-stx (ret (make-Function (list ftype0))))
|
||||
(match* (ftype0 argtys)
|
||||
;; we check that all kw args are optional
|
||||
[((arr: dom rng rest #f (and kws (list (Keyword: _ _ #f) ...)))
|
||||
|
|
|
@ -100,4 +100,10 @@
|
|||
(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))))))
|
||||
23 24))))
|
||||
(check-tooltip (identity 1)
|
||||
(has-types-at? (list (list #rx"^\\(-> One One\\)$"
|
||||
24 32))))
|
||||
(check-tooltip (+ 1 2)
|
||||
(has-types-at? (list (list #rx"^\\(-> Positive-Byte Positive-Byte Positive-Index\\)$"
|
||||
24 25))))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user