> On Jun 24, 2016, at 1:15 PM, Alex Knauth <alexan...@knauth.org> wrote:
> 
> 
>> On Jun 24, 2016, at 1:13 PM, 'John Clements' via Racket Users 
>> <racket-users@googlegroups.com> 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.

Here’s a file that triggers this error. I haven’t made any attempt to minify 
it. You’ll have to install the ‘yaml’ package first. Compiling it with raco 
make typed-yaml.rkt signals this error:

raco make /tmp/typed-yaml.rkt
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
  compilation context...:
   /tmp/typed-yaml.rkt
  context...:
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt:270:0:
 int-err
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/base-env/prims-contract.rkt:277:3
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt:82:0:
 generate-contract-def
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt:192:3:
 for-loop
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt:188:0:
 change-contract-fixups
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/core.rkt:30:10
   
/Users/clements/racket/racket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:24:4
   /Users/clements/racket/racket/collects/compiler/cm.rkt:362:0: compile-zo*
   /Users/clements/racket/racket/collects/compiler/cm.rkt:570:26
   /Users/clements/racket/racket/collects/compiler/cm.rkt:562:42
   /Users/clements/racket/racket/collects/compiler/cm.rkt:634:2: do-check
   /Users/clements/racket/racket/collects/compiler/cm.rkt:722:4
   /Users/clements/racket/pkgs/compiler-lib/compiler/commands/make.rkt:81:8: 
for-loop
   /Users/clements/racket/pkgs/compiler-lib/compiler/commands/make.rkt: 
[running body]
   /Users/clements/racket/racket/collects/raco/raco.rkt: [running body]
   /Users/clements/racket/racket/collects/raco/main.rkt: [running body]




-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: typed-yaml.rkt
Description: Binary data

Attachment: signature.asc
Description: PGP signature

Reply via email to