Bug in Typed Racket

閲覧: 72 回
最初の未読メッセージにスキップ

Antonio Menezes Leitao

未読、
2015/11/08 7:16:462015/11/08
To: Racket Dev
Hi,

The following example works fine:

#lang racket

(define v (vector 1 2 3))
(for ([t (in-vector v 0 2)])
  (displayln t))

However, in Typed Racket, it does not:

Welcome to DrRacket, version 6.3.0.3--2015-11-06(58c919c/a) [3m].
Language: typed/racket; memory limit: 4096 MB.
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: normalise-inputs
  from module: for.rkt in: (for ((t (in-vector v 0 2))) (displayln t))
. Type Checker: type mismatch
  expected: VectorTop
  given: Any in: (for ((t (in-vector v 0 2))) (displayln t))
. Type Checker: Summary: 2 errors encountered in:
  (for ((t (in-vector v 0 2))) (displayln t))
  (for ((t (in-vector v 0 2))) (displayln t))


Best,
António.

Sam Tobin-Hochstadt

未読、
2015/11/08 14:31:352015/11/08
To: Antonio Menezes Leitao、Racket Dev
Thanks for the report! I've got a fix here, which I'm still testing: https://github.com/racket/typed-racket/pull/238

Sam

--
You received this message because you are subscribed to the Google Groups "Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+...@googlegroups.com.
To post to this group, send email to racke...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAJQmiZWNoUkEB7bDyK9E5mUE3WdY40UC8eyTKnP4d5JwWjaKQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Antonio Menezes Leitao

未読、
2015/11/08 16:31:582015/11/08
To: Sam Tobin-Hochstadt、Racket Dev
BTW, the following example typechecks:

(define #:forall (A) (foo [f : (Real -> A)] [b : Boolean]) : (Listof A)
  (list (f 0.1) (f 0.2)))

but the following example generates a lot of complaints:

(define #:forall (A) (foo [f : (Real -> A)] [b : Boolean #t]) : (Listof A)
  (list (f 0.1) (f 0.2)))

Welcome to DrRacket, version 6.3.0.3--2015-11-06(58c919c/a) [3m].
Language: typed/racket; memory limit: 4096 MB.
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: parse error in type;
 type name `A' is unbound in: A
. Type Checker: Summary: 8 errors encountered in:
  A
  A
  A
  A
  A
  A
  A
  A

Best,
António.

Sam Tobin-Hochstadt

未読、
2015/11/09 19:19:022015/11/09
To: Antonio Menezes Leitao、Racket Dev
On Sun, Nov 8, 2015 at 2:31 PM Sam Tobin-Hochstadt <sa...@cs.indiana.edu> wrote:
Thanks for the report! I've got a fix here, which I'm still testing: https://github.com/racket/typed-racket/pull/238

This is now fixed in the git source.

Sam Tobin-Hochstadt

未読、
2015/11/09 19:21:422015/11/09
To: Antonio Menezes Leitao、Racket Dev
Yes, there seems to be a bug with how type variables are scoped with `#:forall`. I recommend using this syntax, which works fine:

(: foo (All (A) (->* ((-> Real A)) (Boolean) (Listof A) )))
(define (foo f [b #t])
  (list (f 0.1) (f 0.2)))

But if you can open an issue on github for your program as well, that would be great.

Sam

On Sun, Nov 8, 2015 at 4:32 PM Antonio Menezes Leitao <antonio.men...@ist.utl.pt> wrote:
BTW, the following example typechecks:

(define #:forall (A) (foo [f : (Real -> A)] [b : Boolean]) : (Listof A)
  (list (f 0.1) (f 0.2)))

but the following example generates a lot of complaints:

(define #:forall (A) (foo [f : (Real -> A)] [b : Boolean #t]) : (Listof A)
  (list (f 0.1) (f 0.2)))

Welcome to DrRacket, version 6.3.0.3--2015-11-06(58c919c/a) [3m].
Language: typed/racket; memory limit: 4096 MB.
全員に返信
投稿者に返信
転送
新着メール 0 件