eq? is a predicate for eof

original commit: f73d63e1afdca9f509ff0a143ae2348875766ce2
This commit is contained in:
Sam Tobin-Hochstadt 2010-06-15 14:59:08 -04:00
parent 8ddbeba6e3
commit 36d46fac77
2 changed files with 9 additions and 2 deletions

View File

@ -811,7 +811,14 @@
[tc-err (do: : Void
([j : Natural (+ i 'a) (+ j i)])
((>= j 10))
#f)])
#f)]
[tc-e/t
(let ([x eof])
(if (procedure? x)
x
(lambda (z) (eq? x z))))
(make-pred-ty (-val eof))]
)
(test-suite
"check-type tests"
(test-exn "Fails correctly" exn:fail:syntax? (lambda () (parameterize ([orig-module-stx #'here])

View File

@ -41,7 +41,7 @@
;; typecheck eq? applications
;; identifier expr expr -> tc-results
(define (tc/eq comparator v1 v2)
(define (eq?-able e) (or (boolean? e) (keyword? e) (symbol? e)))
(define (eq?-able e) (or (boolean? e) (keyword? e) (symbol? e) (eof-object? e)))
(define (eqv?-able e) (or (eq?-able e) (number? e)))
(define (equal?-able e) #t)
(define (ok? val)