diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt index 4d62bec0..d30c0415 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt @@ -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 ...) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt index b48628bf..6aa80d44 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -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"