I am trying to compile a
Typedtree from a
.cmt file to a
ocaml-4.08.1) with this minimal example:
let () = let cmt = Cmt_format.read_cmt Sys.argv.(1) in match cmt.cmt_annots with | Implementation structure -> let tstructure = (structure, Typedtree.Tcoerce_none) in Load_path.init cmt.cmt_loadpath; ignore (Translmod.transl_implementation cmt.cmt_modname tstructure) | _ -> failwith "not a structure"
transl_implementation fails when the source file corresponding to the
.cmt had a definition with a local variable.
For example using the
.cmt (produced with
ocamlopt -bin-annot) from:
let f = let x = 42 in x
the first code fails with:
>> Fatal error: Cannot find address for: x Fatal error: exception Misc.Fatal_error
Did I miss something? It seems to be a problem from
Env which is not set properly so the local variable
x is not found.
Thanks in advance for your time!