> On Jun 24, 2016, at 1:13 PM, 'John Clements' via Racket Users 
> <[email protected]> wrote:
> 
> I was in the middle of editing a TR file, and I got this error:
> 
> ../../racket/racket/share/pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt:270:0:
>  Internal Typechecker Error: contract-def-property: thunk called too early
>  This should only be called after the type-checking pass has finished.
> while typechecking:
> here
> originally:
> here
> 
> This was a totally transient error, and I solved it by continuing to edit the 
> file, but I saved a copy in case anyone’s interested. I can file an 
> (un-minimized) bug report, if desired. Anyone interested?
> 
> John


What were you doing when this happened? Was this using cast? Was the top-level 
involved?

This error comes from the changes I made while fixing cast to protect 
higher-order uses of casted values. 

What happens is, a `cast` expression generates a lifted definition to be filled 
in later with a contract, and it also generates a casted-expr syntax property 
that the type checker will look for later.

When the type checker finds it, it finds the original type of the casted 
expression, and puts it in a table so that the contract-generation pass can 
look up that type later. Then the contract-generation pass calls a thunk that 
looks up the type in the table, and generates a contract for it. If someone 
tries to call the contract-generation code before type checking has finished, 
that's a bug, and it triggers that error. 

I ask about the top-level because there's a `core-cast` form that triggers this 
error if it's used at the top-level, but `cast` generates an `#%expression` 
wrapper around that so that that doesn't happen. Asumu and I thought we fixed 
it, and we tested it, but maybe we didn't test it thoroughly enough?

Anyway I would be interested in how you got this error.

Alex Knauth

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to