However, the fix is very very ugly (it uses unsharing) and clearly shows
a source of inefficiency (and possibly also divergence, I would say).
he
in
let x,xty,subst,metasenv,ugraph =
- type_of_aux subst metasenv context x ugraph
+ (*CSC: here unsharing is necessary to avoid an unwanted
+ relocalization. However, this also shows a great source of
+ inefficiency: "x" is refined twice (once now and once in the
+ subsequent eat_prods_and_args). Morevoer, how is divergence avoided?
+ *)
+ type_of_aux subst metasenv context (Unshare.unshare x) ugraph
in
let carr_src =
CoercDb.coerc_carr_of_term (CicMetaSubst.apply_subst subst xty)