This module implements the merge operation.
val merge_envs :
TypeCore.env * TypeCore.var ->
TypeCore.env * TypeCore.var -> TypeCore.env * TypeCore.var
When the control-flow diverges, one needs to merge the environments, that
is, compute a set of permissions that subsumes the two environments. In order
to run, the
top environment which represents the original environment before the
control-flow started to diverge,
- an optional type annotation which may contain a list of expected
permissions to be available after this merge operation
- a pair of the left environment, and the variable that represents the return
value computed in the left environment
- the same thing for the right environment.
It returns a merged environment along with a variable that points to the
combined return value of the merged environment.
Consider for example "if True then x else y"; the combined return value of
the two environments will try to reconcile the permissions available for "x"