Fix type printing for simple latent filters

Don't print a simple filter for a function with more than
one argument or with a filter object that refers to an outer
variable.

This matches up with type parsing.

Closes PR 14510

original commit: 9435a8f44723091cca2e28879501f922bf910d69
This commit is contained in:
Asumu Takikawa 2014-05-14 00:33:18 -04:00
parent a24c4717a9
commit 4e5c49f7fd
2 changed files with 16 additions and 2 deletions

View File

@ -244,9 +244,13 @@
[(Values: (list (Result: t (FilterSet: (Top:) (Top:)) (Empty:))))
(list (type->sexp t))]
[(Values: (list (Result: t
(FilterSet: (TypeFilter: ft pth id)
(NotTypeFilter: ft pth id))
(FilterSet: (TypeFilter: ft pth (list 0 0))
(NotTypeFilter: ft pth (list 0 0)))
(Empty:))))
;; Only print a simple filter for single argument functions,
;; since parse-type only accepts simple latent filters on single
;; argument functions.
#:when (= 1 (length dom))
(if (null? pth)
`(,(type->sexp t) : ,(type->sexp ft))
`(,(type->sexp t) : ,(type->sexp ft) @

View File

@ -75,6 +75,16 @@
"(-> Any Boolean : String)")
(check-prints-as? (asym-pred Univ -Boolean (-FS (-filter -String 0) -top))
"(-> Any Boolean : #:+ String)")
;; PR 14510 (next three tests)
(check-prints-as? (-> Univ (-> Univ -Boolean : (-FS (-filter -String '(1 0))
(-not-filter -String '(1 0)))))
"(-> Any (-> Any Boolean))")
(check-prints-as? (-> Univ Univ -Boolean : (-FS (-filter -String '(0 1))
(-not-filter -String '(0 1))))
"(-> Any Any Boolean)")
(check-prints-as? (-> Univ Univ -Boolean : (-FS (-filter -String '(0 0))
(-not-filter -String '(0 0))))
"(-> Any Any Boolean)")
(check-prints-as? (-> Univ (make-Values (list (-result -String -top-filter -empty-obj)
(-result -String -top-filter -empty-obj))))
"(-> Any (values String String))")