[racket] typed/racket and contract boundaries

9 views
Skip to first unread message

Spencer Florence

unread,
Jan 27, 2014, 11:25:34 AM1/27/14
to us...@racket-lang.org
I have a typed module being required by a normal #lang racket module.

When I call a function from the typed module I get this error:

default-blame-format: contract violation
  expected: a blame object with a non-#f positive field
  given: #<blame>


Can someone give me some insight into what is going on?

--spencer

Eric Dobson

unread,
Jan 27, 2014, 11:40:38 AM1/27/14
to Spencer Florence, us...@racket-lang.org
This is likely a bug, but I cannot reproduce using the following
program. Do you have a small test case?

#lang racket/load

(module typed typed/racket
(provide foo)
(: foo (Number -> Number))
(define (foo x) (add1 x)))

(module untyped racket
(require 'typed)
(foo 4))

(require 'untyped)
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
____________________
Racket Users list:
http://lists.racket-lang.org/users

Asumu Takikawa

unread,
Jan 27, 2014, 4:35:55 PM1/27/14
to Eric Dobson, us...@racket-lang.org, Spencer Florence
On 2014-01-27 08:40:38 -0800, Eric Dobson wrote:
> This is likely a bug, but I cannot reproduce using the following
> program. Do you have a small test case?

I talked to Spencer and we found this example that produces the same
output:

(module a typed/racket
(: g ((U (Parameterof (-> Void)) (-> Void)) -> Void))
(define (g p) p (void))
(provide g))
(require 'a)
(g (make-parameter void))

It seems to be specific to having a `Parameterof` containing a
function type unioned with a function type.

Cheers,
Asumu

Sam Tobin-Hochstadt

unread,
Jan 27, 2014, 4:43:21 PM1/27/14
to Asumu Takikawa, us...@racket-lang.org, Spencer Florence
On Mon, Jan 27, 2014 at 4:35 PM, Asumu Takikawa <as...@ccs.neu.edu> wrote:
> On 2014-01-27 08:40:38 -0800, Eric Dobson wrote:
>> This is likely a bug, but I cannot reproduce using the following
>> program. Do you have a small test case?
>
> I talked to Spencer and we found this example that produces the same
> output:
>
> (module a typed/racket
> (: g ((U (Parameterof (-> Void)) (-> Void)) -> Void))
> (define (g p) p (void))
> (provide g))
> (require 'a)
> (g (make-parameter void))
>
> It seems to be specific to having a `Parameterof` containing a
> function type unioned with a function type.

Here's the bug without TR:

#lang racket
(module b racket
(define (g p) p (void))
(provide/contract [g
(-> (or/c (parameter/c (-> void?))
(-> void?))
void?)]))
(require 'b)
(g (make-parameter void))

Gives the error:

sw/plt/racket/collects/racket/contract/private/blame.rkt:245:0:
default-blame-format: contract violation
expected: a blame object with a non-#f positive field
given: #<blame>

Sam

Robby Findler

unread,
Jan 27, 2014, 4:57:44 PM1/27/14
to Sam Tobin-Hochstadt, us...@racket-lang.org, Spencer Florence
Thanks!

Robby
Reply all
Reply to author
Forward
0 new messages