Fix typechecking of list* with no args.

original commit: ab92f38f3b309bbee84999aee29a113e4259538c
This commit is contained in:
Eric Dobson 2014-07-05 16:55:31 -07:00
parent 2f4a9a73d5
commit df084d4a10
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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)]