From 7d6888f2291570d05e7cab2b632e6edbc733395e Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 16 Feb 2013 18:00:56 -0800 Subject: [PATCH] Improve types for exit and in-naturals. --- collects/tests/typed-racket/succeed/for.rkt | 6 ++++++ collects/typed-racket/base-env/base-env.rkt | 2 +- collects/typed-racket/base-env/base-special-env.rkt | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/collects/tests/typed-racket/succeed/for.rkt b/collects/tests/typed-racket/succeed/for.rkt index 86493319d3..9cdb60936b 100644 --- a/collects/tests/typed-racket/succeed/for.rkt +++ b/collects/tests/typed-racket/succeed/for.rkt @@ -226,6 +226,12 @@ (vector 5 5 5)) +(check equal? + (for/list: : (Listof Natural) + ((i : Natural (and (in-naturals))) + (j : Natural (and (in-range 5)))) + (+ i j)) + (list 0 2 4 6 8)) ;; break and final clauses ;; TODO typechecker can't handle these diff --git a/collects/typed-racket/base-env/base-env.rkt b/collects/typed-racket/base-env/base-env.rkt index c40abb643e..2cafdf5526 100644 --- a/collects/typed-racket/base-env/base-env.rkt +++ b/collects/typed-racket/base-env/base-env.rkt @@ -1129,7 +1129,7 @@ ;Section 9.7 (Exiting) -[exit (-> (Un))] +[exit (->opt [Univ] (Un))] [exit-handler (-Param (-> Univ ManyUniv) (-> Univ ManyUniv))] [executable-yield-handler (-Param (-> -Byte ManyUniv) (-> -Byte ManyUniv))] diff --git a/collects/typed-racket/base-env/base-special-env.rkt b/collects/typed-racket/base-env/base-special-env.rkt index c521141bc5..bcb5284848 100644 --- a/collects/typed-racket/base-env/base-special-env.rkt +++ b/collects/typed-racket/base-env/base-special-env.rkt @@ -84,7 +84,8 @@ (->opt -Real -Real [-Real] (-seq -Real)))] ;; in-naturals [(make-template-identifier 'in-naturals 'racket/private/for) - (cl->* (-> -PosInt (-seq -PosInt)) + (cl->* (-> (-seq -Nat)) + (-> -PosInt (-seq -PosInt)) (-> -Int (-seq -Nat)))] ;; in-list [(make-template-identifier 'in-list 'racket/private/for)