[racket-dev] [plt] Push #26861: master branch updated

From: Eric Dobson (eric.n.dobson at gmail.com)
Date: Sun May 19 20:55:26 EDT 2013

This doesn't pass with contract checking enabled. make-StructTop
requires a Struct? not any old Type?. Is there a reason that the type
is not just bottom?

On Sun, May 19, 2013 at 5:33 PM,  <asumu at racket-lang.org> wrote:
> asumu has updated `master' from d9102ac7e7 to 3eb4a75613.
>   http://git.racket-lang.org/plt/d9102ac7e7..3eb4a75613
>
> =====[ One Commit ]=====================================================
> Directory summary:
>   46.8% collects/tests/typed-racket/fail/
>   53.1% collects/typed-racket/private/
>
> ~~~~~~~~~~
>
> 3eb4a75 Asumu Takikawa <asumu at racket-lang.org> 2013-05-19 20:31
> :
> | Fix parsing of (Struct ...) types.
> |
> | This was a regression that appeared in 5.3.1
> :
>   A collects/tests/typed-racket/fail/bad-struct-top.rkt
>   M collects/typed-racket/private/parse-type.rkt | 4 ++--
>
> =====[ Overall Diff ]===================================================
>
> collects/tests/typed-racket/fail/bad-struct-top.rkt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- /dev/null
> +++ NEW/collects/tests/typed-racket/fail/bad-struct-top.rkt
> @@ -0,0 +1,7 @@
> +#;
> +(exn:pred #rx"Argument to Struct must be a structure")
> +#lang typed/racket
> +
> +;; Make sure `Struct` constructor rejects bad arguments
> +(: x (Struct Integer))
> +
>
> collects/typed-racket/private/parse-type.rkt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/collects/typed-racket/private/parse-type.rkt
> +++ NEW/collects/typed-racket/private/parse-type.rkt
> @@ -177,9 +177,9 @@
>         (add-disappeared-use #'kw)
>         (let ([v (parse-type #'t)])
>           (match (resolve v)
> -           [(and s Struct?) (make-StructTop s)]
> +           [(and s (? Struct?)) (make-StructTop s)]
>             [_ (tc-error/delayed "Argument to Struct must be a structure type, got ~a" v)
> -              (make-Instance (Un))]))]
> +              (make-StructTop (Un))]))]
>        [((~and kw t:Instance) t)
>         (add-disappeared-use #'kw)
>         (let ([v (parse-type #'t)])

Posted on the dev mailing list.