Don't special case typechecking of =.
Its type is more useful than the special typing rule. original commit: 568f401bdcea778acfa8c1b80f18b23e9e9c9345
This commit is contained in:
parent
916a8bf3e2
commit
327c55a28b
6
collects/tests/typed-racket/succeed/num-equal-filter.rkt
Normal file
6
collects/tests/typed-racket/succeed/num-equal-filter.rkt
Normal file
|
@ -0,0 +1,6 @@
|
|||
#lang typed/racket
|
||||
|
||||
(: f : Nonnegative-Integer -> Boolean)
|
||||
(define (f x)
|
||||
(cond [(= 0 x) #t]
|
||||
[else (f (sub1 x))])) ; here, x is Positive-Integer
|
|
@ -19,9 +19,10 @@
|
|||
(export tc-app-eq^)
|
||||
|
||||
;; comparators that inform the type system
|
||||
;; `=' is not included. Its type is more useful than this typing rule.
|
||||
(define-syntax-class comparator
|
||||
#:literals (eq? equal? eqv? = string=? symbol=? memq member memv)
|
||||
(pattern eq?) (pattern equal?) (pattern eqv?) (pattern =) (pattern string=?) (pattern symbol=?)
|
||||
#:literals (eq? equal? eqv? string=? symbol=? memq member memv)
|
||||
(pattern eq?) (pattern equal?) (pattern eqv?) (pattern string=?) (pattern symbol=?)
|
||||
(pattern member) (pattern memq) (pattern memv))
|
||||
|
||||
|
||||
|
@ -46,7 +47,7 @@
|
|||
(define-syntax-rule (alt nm pred ...)
|
||||
(and (free-identifier=? #'nm comparator) (or (pred val) ...)))
|
||||
(or (alt symbol=? symbol?)
|
||||
(alt string=? string?)
|
||||
(alt string=? string?)
|
||||
(alt eq? eq?-able)
|
||||
(alt eqv? eqv?-able)
|
||||
(alt equal? equal?-able)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user