fix type of integer-bytes->integer

and the corresponding tests
This commit is contained in:
Ben Greenman 2017-07-12 16:40:39 -04:00
parent 55114e298e
commit 4bf6961551
2 changed files with 4 additions and 7 deletions

View File

@ -311,11 +311,8 @@
[integer->integer-bytes (-Integer index-type Univ [Univ -Bytes index-type] . ->opt . -Bytes)]
[integer-bytes->integer
(cl->*
;; Any truthy value (not only #t) would work here.
;; We can define a truthy type (without difference types (- Univ #f))
;; by unioning everything (including StructTop and co).
;; We should do this at some point.
(-Bytes (-val #t) [Univ index-type index-type] . ->opt . -Nat)
;; Second argument is `signed?` --- if `#false` the result is a `-Nat`
(-Bytes (-val #f) [Univ index-type index-type] . ->opt . -Nat)
(-Bytes Univ [Univ index-type index-type] . ->opt . -Integer))]
[peek-char

View File

@ -664,8 +664,8 @@
(when (boolean? x) #t))
-Void]
[tc-e (integer-bytes->integer '#"abcd" #t) -Nat]
[tc-e (integer-bytes->integer '#"abcd" #f) -Int]
[tc-e (integer-bytes->integer '#"abcd" #t) -Int]
[tc-e (integer-bytes->integer '#"abcd" #f) -Nat]
[tc-e/t (let: ([x : Any 3])
(if (list? x)