From a9fc827be72721aaf886f40a5ae8ec6bf38dd691 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Wed, 20 Nov 2013 21:23:00 -0800 Subject: [PATCH] Correctly typecheck all subelements of vector literals. Closes PR 14184. original commit: cbe1b532795819d45c9bc8ccbaf1507c21b01649 --- .../typed-racket-lib/typed-racket/typecheck/tc-literal.rkt | 7 ++++--- .../tests/typed-racket/unit-tests/typecheck-tests.rkt | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-literal.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-literal.rkt index 375ee6a7..ccf175d3 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-literal.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-literal.rkt @@ -8,7 +8,8 @@ (only-in (infer infer) restrict) (utils stxclass-util) syntax/parse - unstable/function) + unstable/function + unstable/sequence) (import) (export tc-literal^) @@ -95,8 +96,8 @@ [(HeterogeneousVector: ts) (make-HeterogeneousVector (for/list ([l (in-vector (syntax-e #'i))] - [t (in-list ts)]) - (check-below (tc-literal l t) t)))] + [t (in-sequence-forever (in-list ts) #f)]) + (cond-check-below (tc-literal l t) t)))] [_ (make-HeterogeneousVector (for/list ([l (in-vector (syntax-e #'i))]) (generalize (tc-literal l #f))))])] [(~var i (3d hash?)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt index 9decd2d1..11e87a58 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -311,6 +311,8 @@ [tc-e (void 3 4) -Void] [tc-e (void #t #f '(1 2 3)) -Void] [tc-e/t #() (make-HeterogeneousVector (list))] + [tc-err #(3) #:expected (ret (make-HeterogeneousVector (list -Integer -Integer)))] + [tc-err #(3 4 5) #:expected (ret (make-HeterogeneousVector (list -Integer -Integer)))] [tc-e/t #(3 4 5) (make-HeterogeneousVector (list -Integer -Integer -Integer))] [tc-e/t '(2 3 4) (-lst* -PosByte -PosByte -PosByte)] [tc-e/t '(2 3 #t) (-lst* -PosByte -PosByte (-val #t))]