Don't use number literal types as contracts
Using = for the comparison doesn't work for TR
Fixes bug in 295a4b7e39
This commit is contained in:
parent
285a2b796d
commit
bc6e9e80cc
|
@ -627,6 +627,9 @@
|
|||
(syntax/sc (t->sc t))]
|
||||
[(Value: v)
|
||||
(if (and (c:flat-contract? v)
|
||||
;; numbers used as contracts compare with =, but TR
|
||||
;; requires an equal? check
|
||||
(not (number? v))
|
||||
;; regexps don't match themselves when used as contracts
|
||||
(not (regexp? v)))
|
||||
(flat/sc #`(quote #,v))
|
||||
|
|
|
@ -368,6 +368,18 @@
|
|||
#:untyped
|
||||
#:msg #rx"that accepts 1 non-keyword")
|
||||
|
||||
;; Value types with numbers shouldn't be checked with =
|
||||
(t-int/fail (make-Value 3.0)
|
||||
values
|
||||
3
|
||||
#:untyped
|
||||
#:msg #rx"promised: 3.0")
|
||||
(t-int/fail (make-Value 3)
|
||||
values
|
||||
3.0
|
||||
#:untyped
|
||||
#:msg #rx"promised: 3")
|
||||
|
||||
;; intersection types
|
||||
(t (-unsafe-intersect (-seq -Symbol) (-pair -Symbol (-lst -Symbol))))
|
||||
(t/fail (-unsafe-intersect (-Number . -> . -Number) (-String . -> . -String))
|
||||
|
|
Loading…
Reference in New Issue
Block a user