Literal vectors are now given HeterogenousVector types to preserve

length information.
This commit is contained in:
Vincent St-Amour 2010-07-01 15:24:52 -04:00
parent 25cb5ef568
commit 8c25e46141
2 changed files with 4 additions and 5 deletions

View File

@ -154,10 +154,10 @@
[tc-e (void) -Void]
[tc-e (void 3 4) -Void]
[tc-e (void #t #f '(1 2 3)) -Void]
[tc-e/t #(3 4 5) (make-Vector -Nat)]
[tc-e/t #(3 4 5) (make-HeterogenousVector (list -Nat -Nat -Nat))]
[tc-e/t '(2 3 4) (-lst* -PositiveFixnum -PositiveFixnum -PositiveFixnum)]
[tc-e/t '(2 3 #t) (-lst* -PositiveFixnum -PositiveFixnum (-val #t))]
[tc-e/t #(2 3 #t) (make-Vector (t:Un -Nat (-val #t)))]
[tc-e/t #(2 3 #t) (make-HeterogenousVector (list -Nat -Nat (-val #t)))]
[tc-e/t '(#t #f) (-lst* (-val #t) (-val #f))]
[tc-e/t (plambda: (a) ([l : (Listof a)]) (car l))
(make-Poly '(a) (t:-> (make-Listof (-v a)) (-v a)))]

View File

@ -80,9 +80,8 @@
[t (in-list ts)])
(tc-literal l t)))]
;; errors are handled elsewhere
[_ (make-Vector (apply Un
(for/list ([l (syntax-e #'i)])
(generalize (tc-literal l #f)))))])]
[_ (make-HeterogenousVector (for/list ([l (syntax-e #'i)])
(generalize (tc-literal l #f))))])]
[(~var i (3d hash?))
(let* ([h (syntax-e #'i)]
[ks (hash-map h (lambda (x y) (tc-literal x)))]