From ab92f38f3b309bbee84999aee29a113e4259538c Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 5 Jul 2014 16:55:31 -0700 Subject: [PATCH] Fix typechecking of list* with no args. --- .../typed-racket/typecheck/tc-app/tc-app-list.rkt | 4 ++-- .../tests/typed-racket/unit-tests/typecheck-tests.rkt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app/tc-app-list.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app/tc-app-list.rkt index 0f22f3ed6e..6b4cf18d7a 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app/tc-app-list.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app/tc-app-list.rkt @@ -97,8 +97,8 @@ (tc-expr/check/t i (ret (subst-all subst (make-F v)))) (tc-expr/t i))))))) ;; special case for `list*' - (pattern (list* . args) - (match-let* ([(list tys ... last) (stx-map tc-expr/t #'args)]) + (pattern (list* (~between args:expr 1 +inf.0) ...) + (match-let* ([(list tys ... last) (stx-map tc-expr/t #'(args ...))]) (ret (foldr -pair last tys)))) ;; special case for `reverse' to propagate expected type info (pattern ((~and fun (~or reverse k:reverse)) arg) 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 dcb10d3059..b1f8832fd9 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 @@ -1000,6 +1000,7 @@ [tc-e/t (if #f 1 'foo) (-val 'foo)] [tc-e (list* 1 2 3) (-pair -One (-pair -PosByte -PosByte))] + [tc-err (list*)] [tc-err (apply append (list 1) (list 2) (list 3) (list (list 1) "foo"))] [tc-e (apply append (list 1) (list 2) (list 3) (list (list 1) (list 1))) (-lst -PosByte)]