diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-annotation.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-annotation.rkt index adec08e9..88e0e121 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-annotation.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-annotation.rkt @@ -11,6 +11,7 @@ racket/match) (provide type-annotation + type-annotation^ get-type get-types get-type/infer @@ -44,6 +45,11 @@ (attribute i.type)] [_ #f])) +(define-syntax-class type-annotation^ + [pattern i:id + #:attr type (type-annotation #'i) + #:when (attribute type)]) + ;(trace type-annotation) (define (type-ascription stx) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt index 90880105..f9c2b8e4 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt @@ -2,7 +2,7 @@ (require "../utils/utils.rkt" (except-in (types utils abbrev union filter-ops) -> ->* one-of/c) - (only-in (types abbrev) (-> t:->)) + (only-in (types abbrev) (-> t:->) [->* t:->*]) (private type-annotation parse-type syntax-properties) (env lexical-env type-alias-env type-alias-helper mvar-env global-env type-env-structs scoped-tvar-env) @@ -302,9 +302,10 @@ ;; say that this binding is only called in tail position (define ((tc-expr-t/maybe-expected expected) e) (syntax-parse e #:literal-sets (kernel-literals) - [(~and (#%plain-lambda () _) _:tail-position^) + [(~and (#%plain-lambda (fmls:type-annotation^ ...) _) _:tail-position^) #:when expected - (tc-expr/check e (ret (t:-> (tc-results->values expected))))] + (define arg-tys (attribute fmls.type)) + (tc-expr/check e (ret (t:->* arg-tys (tc-results->values expected))))] [_:tail-position^ #:when expected (tc-expr/check e expected)]