I recently tried to make use of the typedtree info in a .cmt file and found that the stored ‘initial’ environment yielded to look-ups of type declarations made in the associated source file.
my first question is:
- in what sense is cmt_initial_env initial, and not named final_env?
when an interface file is used and the type declarations are abstract, the look-up
of such declarations yields abstracted results.
I have tried chasing the code of [Includemod.compunit] as I imagine somewhere there the said environment is being side-effected into an abstract version.
with no luck there I’d really like to know:
- how is the final environment saved to the .cmt being transformed with abstracted type declarations? (indeed it appears to effect environments stored in the nodes of the typedtree too)
given that when there is an interface file, with -bin-annot a .cmti file created,
- why is it that the abstracted environment is not confined to there rather than constraining the .cmt too?
it seems odd to me to make available the typedtree (in the .cmt) only to then restrict the information embedded within it.
my own intended use for it was debugging.