Updated TR's base type environment to use the new numeric types.
This ended up being an almost complete rewrite of the base environment. Note: While the commit is dated Jan 27, the work was finished on Mar 2. original commit: ee29d371c9e6882edfc78621110bd11260ee942a
This commit is contained in:
parent
f2c0187b07
commit
f0bdca6383
|
@ -5,4 +5,4 @@
|
|||
|
||||
#lang typed/scheme
|
||||
#:optimize
|
||||
(/ 1 2.0) ; result is not a float, can't optimize
|
||||
(/ (ann 1 Integer) 2.0) ; result is not a float, can't optimize
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
#lang typed/scheme
|
||||
#:optimize
|
||||
|
||||
(real-part (log 2.0))
|
||||
(real-part (log (ann 2.0 Float)))
|
||||
|
|
16
collects/tests/typed-scheme/succeed/fx-filter.rkt
Normal file
16
collects/tests/typed-scheme/succeed/fx-filter.rkt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang typed/racket
|
||||
|
||||
;; test filters on fx primitives that tell us that if the function
|
||||
;; returns at all, its arguments were fixnums
|
||||
;; currently only works if the fx operation is used in test position,
|
||||
;; due to the way filters are used. this should be improved in the
|
||||
;; future
|
||||
|
||||
(require racket/fixnum)
|
||||
|
||||
(: f : Integer -> Fixnum)
|
||||
(define (f x)
|
||||
(if (fx+ x 4) x x))
|
||||
(: g : Integer -> Fixnum)
|
||||
(define (g x)
|
||||
(if (fxnot x) x x))
|
|
@ -165,6 +165,13 @@
|
|||
(tc-e/t -1073741825 -NegInt)
|
||||
(tc-e/t "foo" -String)
|
||||
(tc-e (+ 3 4) -PosIndex)
|
||||
(tc-e (- 1) -NegFixnum)
|
||||
(tc-e (- 1073741823) -NegFixnum)
|
||||
(tc-e (- -4) -PosFixnum)
|
||||
(tc-e (- 3253463567262345623) -NegInt)
|
||||
(tc-e (- -23524623547234734568) -PosInt)
|
||||
(tc-e (- 241.3) -NegFlonum)
|
||||
(tc-e (- -24.3) -PosFlonum)
|
||||
[tc-e/t (lambda: () 3) (t:-> -PosByte : -true-lfilter)]
|
||||
[tc-e/t (lambda: ([x : Number]) 3) (t:-> N -PosByte : -true-lfilter)]
|
||||
[tc-e/t (lambda: ([x : Number] [y : Boolean]) 3) (t:-> N B -PosByte : -true-lfilter)]
|
||||
|
@ -285,7 +292,7 @@
|
|||
[tc-err (5 4)]
|
||||
[tc-err (apply 5 '(2))]
|
||||
[tc-err (map (lambda: ([x : Any] [y : Any]) 1) '(1))]
|
||||
[tc-e (map add1 '(1)) (-pair -Pos (-lst -Pos))]
|
||||
[tc-e (map add1 '(1)) (-pair -PosByte (-lst -PosByte))]
|
||||
|
||||
[tc-e/t (let ([x 5])
|
||||
(if (eq? x 1)
|
||||
|
@ -600,7 +607,7 @@
|
|||
(define y 2)
|
||||
(define z (+ x y))
|
||||
(* x z))
|
||||
-Pos]
|
||||
-PosIndex]
|
||||
|
||||
[tc-e/t (let ()
|
||||
(define: (f [x : Number]) : Number
|
||||
|
@ -819,8 +826,8 @@
|
|||
(define: x : Any 7)
|
||||
(if (box? x) (unbox x) (+ 1)))
|
||||
Univ]
|
||||
[tc-e (floor 1/2) -Integer]
|
||||
[tc-e (ceiling 1/2) -Integer]
|
||||
[tc-e (floor 1/2) -Nat]
|
||||
[tc-e (ceiling 1/2) -PosInt]
|
||||
[tc-e (truncate 0.5) -NonNegFlonum]
|
||||
[tc-e (truncate -0.5) -NonPosFlonum]
|
||||
[tc-e/t (ann (lambda (x) (lambda (x) x))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -168,19 +168,19 @@
|
|||
#'(and/c single-flonum? positive?)
|
||||
(lambda (x) #f)
|
||||
#'-PosSingleFlonum))
|
||||
(define -PosInexactReal (*Un -PosSingleFlonum -PosFlonum))
|
||||
(define -NonNegSingleFlonum (*Un -PosSingleFlonum -SingleFlonumPosZero))
|
||||
(define -NonNegInexactReal (*Un -PosInexactReal -InexactRealPosZero))
|
||||
(define -PosInexactReal (*Un -PosSingleFlonum -PosFlonum))
|
||||
(define -NonNegSingleFlonum (*Un -PosSingleFlonum -SingleFlonumPosZero))
|
||||
(define -NonNegInexactReal (*Un -PosInexactReal -InexactRealPosZero))
|
||||
(define -NegSingleFlonum
|
||||
(make-Base 'Negative-Single-Flonum
|
||||
#'(and/c single-flonum? negative?)
|
||||
(lambda (x) #f)
|
||||
#'-NegSingleFlonum))
|
||||
(define -NegInexactReal (*Un -NegSingleFlonum -NegFlonum))
|
||||
(define -NonPosSingleFlonum (*Un -NegSingleFlonum -SingleFlonumNegZero))
|
||||
(define -NonPosInexactReal (*Un -NegInexactReal -InexactRealNegZero))
|
||||
(define -SingleFlonum (*Un -NegSingleFlonum -SingleFlonumNegZero -SingleFlonumPosZero -PosSingleFlonum -SingleFlonumNan))
|
||||
(define -InexactReal (*Un -SingleFlonum -Flonum))
|
||||
(define -NegInexactReal (*Un -NegSingleFlonum -NegFlonum))
|
||||
(define -NonPosSingleFlonum (*Un -NegSingleFlonum -SingleFlonumNegZero))
|
||||
(define -NonPosInexactReal (*Un -NegInexactReal -InexactRealNegZero))
|
||||
(define -SingleFlonum (*Un -NegSingleFlonum -SingleFlonumNegZero -SingleFlonumPosZero -PosSingleFlonum -SingleFlonumNan))
|
||||
(define -InexactReal (*Un -SingleFlonum -Flonum))
|
||||
|
||||
;; Reals
|
||||
(define -RealZero (*Un -Zero -InexactRealZero))
|
||||
|
|
Loading…
Reference in New Issue
Block a user