From 1194117dbaa5e7b61c63297807f7db6c3acef8d8 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 23 Feb 2013 09:28:04 -0800 Subject: [PATCH] Make kw/opt lambda special checks work with other expected values. Closes PR13544. original commit: d59a600be69da8a487950c2bfbc663a516fc90d4 --- collects/tests/typed-racket/xfail/opt-lambda.rkt | 4 ++++ collects/typed-racket/typecheck/tc-expr-unit.rkt | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-racket/xfail/opt-lambda.rkt diff --git a/collects/tests/typed-racket/xfail/opt-lambda.rkt b/collects/tests/typed-racket/xfail/opt-lambda.rkt new file mode 100644 index 00000000..9c794942 --- /dev/null +++ b/collects/tests/typed-racket/xfail/opt-lambda.rkt @@ -0,0 +1,4 @@ +#lang typed/racket/base + + +(opt-lambda: ((p : Symbol) (log? : Any #f) (1-p? : Any #f)) (ann p Symbol)) diff --git a/collects/typed-racket/typecheck/tc-expr-unit.rkt b/collects/typed-racket/typecheck/tc-expr-unit.rkt index 148bcd45..2a93b699 100644 --- a/collects/typed-racket/typecheck/tc-expr-unit.rkt +++ b/collects/typed-racket/typecheck/tc-expr-unit.rkt @@ -385,7 +385,8 @@ [(tc-result1: (and f (or (Function: _) (Poly: _ (Function: _))))) (tc-expr/check/type #'fun (kw-convert f #:split #t))] - [(tc-result1: _) (tc-error/expr "Keyword functions must have function type, given ~a" expected)]) + [(or (tc-results: _) (tc-any-results:)) + (tc-error/expr "Keyword functions must have function type, given ~a" expected)]) expected] ;; let [(let-values ([(name ...) expr] ...) . body)