Open AlexKnauth opened 8 years ago
An easy workaround for these types of examples would be using (cast (ann x Any) ...)
. However, that's too restrictive to do in general because it disallows higher order uses of casted values. The contract does need to take advantage of the original type, but it should be able to fall back to any-wrap/c
for things like type variables.
Is that the right thing to do?
In racket version 6.5.0.5, if I run this program:
I expect it to succeed and create an identity function, but instead I get this compile-time error
This error comes from line 446 of type-contract.rkt, where there's a TODO: https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/private/type-contract.rkt#L446
Instead of raising this error on types with type variables, should this generate an
any-wrap/c
contract? That would be much better for backwards compatibility.