summaryrefslogtreecommitdiff
path: root/src/pretty_print_coq.ml
diff options
context:
space:
mode:
authorBrian Campbell2018-07-16 18:29:18 +0100
committerBrian Campbell2018-07-16 18:29:45 +0100
commiteec725af3dbfc0e8c0ccb79cf8eb457ff5cf68a4 (patch)
tree01f5db2406e970858a057e3bd346742f7ebbdc4d /src/pretty_print_coq.ml
parent0effbdd2468859924363fe00f29c0afcb727f065 (diff)
Coq: fix false existential problem
Diffstat (limited to 'src/pretty_print_coq.ml')
-rw-r--r--src/pretty_print_coq.ml13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pretty_print_coq.ml b/src/pretty_print_coq.ml
index 7a31465d..32a560ea 100644
--- a/src/pretty_print_coq.ml
+++ b/src/pretty_print_coq.ml
@@ -1023,16 +1023,17 @@ let doc_exp_lem, doc_let_lem =
(* Decide whether to unpack an existential result, pack one, or cast.
To do this we compare the expected type stored in the checked expression
with the inferred type. *)
- let ret_typ_inst =
- match infer_exp env (strip_exp full_exp) with
- | typed_exp -> typ_of typed_exp
+ let inst =
+ match instantiation_of_without_type full_exp with
+ | x -> x
(* Not all function applications can be inferred, so try falling back to the
type inferred when we know the target type.
TODO: there are probably some edge cases where this won't pick up a need
to cast. *)
- | exception _ ->
- let inst = instantiation_of full_exp in
- let inst = KBindings.fold (fun k u m -> KBindings.add (orig_kid k) u m) inst KBindings.empty in
+ | exception _ -> instantiation_of full_exp
+ in
+ let inst = KBindings.fold (fun k u m -> KBindings.add (orig_kid k) u m) inst KBindings.empty in
+ let ret_typ_inst =
subst_unifiers inst ret_typ
in
let unpack,build_ex,autocast =