From 1d2a50c63ebf7cfb08f6dc2383d99281045fd1c0 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 27 Jun 2012 11:37:50 -0400 Subject: [PATCH] Update types of string-join and add-between. original commit: db6c2e77371e31d0bed4cc504e5c8effe42959aa --- .../tests/typed-racket/unit-tests/typecheck-tests.rkt | 5 ++++- collects/typed-racket/base-env/base-env.rkt | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt index ab6754e3..e77d18ce 100644 --- a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -339,7 +339,10 @@ -String] [tc-e (string-join '("hello" "world") " ") -String] [tc-e (string-join '("hello" "world")) -String] - [tc-e (string-join '("hello" "world") #:first "a") -String] + [tc-e (string-join '("hello" "world") #:before-first "a") -String] + [tc-e (add-between '(1 2 3) 0) (-lst -Byte)] + [tc-e (add-between '(1 2 3) 'a) (-lst (t:Un -PosByte (-val 'a)))] + [tc-e ((inst add-between Positive-Byte Symbol) '(1 2 3) 'a #:before-first 'b) (-lst (t:Un -PosByte -Symbol))] [tc-e (apply (plambda: (a) [x : a *] x) '(5)) (-lst -PosByte)] [tc-e (apply append (list '(1 2 3) '(4 5 6))) (-lst -PosByte)] diff --git a/collects/typed-racket/base-env/base-env.rkt b/collects/typed-racket/base-env/base-env.rkt index a63b5b7d..5cd1525e 100644 --- a/collects/typed-racket/base-env/base-env.rkt +++ b/collects/typed-racket/base-env/base-env.rkt @@ -366,7 +366,7 @@ [string-join (->optkey (-lst -String) [-String] - #:before-last -String #f #:first -String #f #:last -String #f + #:before-last -String #f #:before-first -String #f #:after-last -String #f -String)] @@ -1393,7 +1393,13 @@ (-> (make-pred-ty a) (-lst b) (-values (list (-lst a) (-lst b))))))] [last (-poly (a) ((-lst a) . -> . a))] -[add-between (-poly (a b) ((-lst a) b . -> . (-lst (Un a b))))] +[add-between (-poly (a b) ((-lst a) b + #:splice? -Boolean #f + #:nothing Univ #f ; default is gensym + #:before-first b #f + #:before-last b #f + #:after-last b #f + . ->key . (-lst (Un a b))))] [last-pair (-poly (a) ((-mu x (Un a (-val '()) (-pair a x))) . -> .