Parse identifier objects in filters

original commit: 7ff8d8d6b750edc258f622bafec3a80bd880b1d5
This commit is contained in:
Asumu Takikawa 2013-09-06 14:54:19 -04:00
parent 85f997b4c7
commit 6188a21d8a
2 changed files with 16 additions and 0 deletions

View File

@ -119,8 +119,12 @@
(pattern (~literal Bot) #:attr prop -bot)
(pattern (t:expr (~describe "@" (~datum @)) pe:path-elem ... i:nat)
#:attr prop (-filter (parse-type #'t) (syntax-e #'i) (attribute pe.pe)))
(pattern (t:expr (~describe "@" (~datum @)) pe:path-elem ... i:id)
#:attr prop (-filter (parse-type #'t) #'i (attribute pe.pe)))
(pattern ((~datum !) t:expr (~describe "@" (~datum @)) pe:path-elem ... i:nat)
#:attr prop (-not-filter (parse-type #'t) (syntax-e #'i) (attribute pe.pe)))
(pattern ((~datum !) t:expr (~describe "@" (~datum @)) pe:path-elem ... i:id)
#:attr prop (-not-filter (parse-type #'t) #'i (attribute pe.pe)))
(pattern ((~literal and) p:prop ...)
#:attr prop (apply -and (attribute p.prop)))
(pattern ((~literal or) p:prop ...)

View File

@ -1753,6 +1753,18 @@
[tc-e/t (inst (ann (lambda (a) a) (All (a) (a -> a))) Symbol)
(t:-> -Symbol -Symbol)]
;; This test makes sure that a user written filter
;; can reference an identifier object in addition to
;; an integer object.
[tc-e/t
(λ (x)
(define f
(ann (λ (y) (exact-integer? x))
;; note the filters
(Any -> Boolean : #:+ (Integer @ x) #:- (! Integer @ x))))
(if (f 'dummy) (add1 x) 2))
(t:-> Univ -Integer : (-FS -top (-filter -Integer 0)))]
)
(test-suite
"tc-literal tests"