diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/signatures.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/signatures.rkt index 233e345dc8..bc6c0fff9b 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/signatures.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/signatures.rkt @@ -9,7 +9,6 @@ ([cond-contracted tc-expr (syntax? . -> . full-tc-results/c)] [cond-contracted tc-expr/check (syntax? (or/c tc-results/c #f) . -> . full-tc-results/c)] [cond-contracted tc-expr/check/t (syntax? tc-results/c . -> . Type/c)] - [cond-contracted tc-body (syntax? . -> . full-tc-results/c)] [cond-contracted tc-body/check (syntax? (or/c tc-results/c #f) . -> . full-tc-results/c)] [cond-contracted tc-expr/t (syntax? . -> . Type/c)] [cond-contracted single-value ((syntax?) ((or/c tc-results/c #f)) . ->* . full-tc-results/c)])) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt index f982c62df8..c1621c6de4 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-expr-unit.rkt @@ -155,6 +155,8 @@ ;; begin [(begin . es) (tc-body/check #'es expected)] + [(begin0 e) + (tc-expr/check #'e expected)] [(begin0 e . es) (begin0 (tc-expr/check #'e expected) @@ -265,15 +267,11 @@ (with-lexical-env/extend-props props (k))) -;; type-check a body of exprs, producing the type of the last one. -;; if the body is empty, the type is Void. -;; syntax[list[expr]] -> tc-results/c -(define (tc-body body) - (tc-body/check body #f)) - +;; tc-body/check: syntax? tc-results? -> tc-results? +;; Body must be a non empty sequence of expressions to typecheck. +;; The final one will be checked against expected. (define (tc-body/check body expected) (match (syntax->list body) - [(list) (cond-check-below (ret -Void) expected)] [(list es ... e-final) (define ((continue es)) (if (empty? es) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt index 4fb8014a4e..a86b7bc00f 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt @@ -179,7 +179,7 @@ null #f #f - (tc-body body))))) + (tc-body/check body #f))))) @@ -218,7 +218,7 @@ null #f (list rest-id (cons rest-type bound)) - (tc-body body)))))] + (tc-body/check body #f)))))] ;; Lambda with regular rest argument [rest-id (let ([rest-type (get-type rest-id #:default Univ)]) @@ -230,7 +230,7 @@ null (list rest-id rest-type) #f - (tc-body body))))] + (tc-body/check body #f))))] ;; Lambda with no rest argument [else (with-lexical-env/extend @@ -240,7 +240,7 @@ null #f #f - (tc-body body)))]))])) + (tc-body/check body #f)))]))])) ;; positional: natural? - the number of positional arguments ;; rest: boolean? - if there is a positional argument