<div dir="ltr">Well, given that replacing check-equal? with equal? (on the typed side) works, then it seems to me that one solution would be to move more of rackunit into TR, or to refactor rackunit to be more friendly to TR. (And if someone is going to work on this, then it would also be great if the error messages from failed test cases were made a bit more legible.)<div>
<br></div><div style>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 29, 2013 at 6:53 AM, Sam Tobin-Hochstadt <span dir="ltr"><<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That is indeed the correct fix. I'm not entirely sure how to improve<br>
the error message, since the problem in your original code is real.<br>
There's no way the generated contract can tell at runtime that the<br>
values passed to `check-equal?` aren't higher-order, so it has to<br>
conservatively reject the call. Suggestions are certainly welcome.<br>
<br>
Sam<br>
<div><div class="h5"><br>
On Wed, May 29, 2013 at 7:46 AM, Robby Findler<br>
<<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>> wrote:<br>
> I'm not sure if this should be considered a bug or a feature request (or<br>
> something else, but hopefully one of those two!) so I thought I'd ask here<br>
> before sending in a PR. This program:<br>
><br>
> #lang typed/racket<br>
> (require typed/rackunit)<br>
> (struct: s ([a : Integer]))<br>
> (check-equal? (s 1) (s 2))<br>
><br>
> produces the output:<br>
><br>
> check-equal?: broke its contract<br>
> Attempted to use a higher-order value passed as `Any` in untyped code:<br>
> #<s><br>
> in: the 1st argument of<br>
> (recursive-contract<br>
> (->* (Any Any) (String) any/c)<br>
> #:impersonator)<br>
> contract from: (interface for check-equal?)<br>
> blaming: (interface for check-equal?)<br>
> at: <collects>/typed/rackunit/main.rkt:20.2<br>
><br>
> which is a bit confusing. (As someone who's been around Racket long enough,<br>
> I guessed that sticking #:transparent into the struct declaration would be a<br>
> thing to try, but newcomers seem unlikely to find that workaround.)<br>
><br>
> Robby<br>
><br>
><br>
</div></div>> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
><br>
</blockquote></div><br></div>