From b0e52bbbc52691343b3fab927b20c1f512f59976 Mon Sep 17 00:00:00 2001 From: Pierre Letouzey Date: Fri, 21 Jul 2017 12:02:36 +0200 Subject: Extraction: reduce primitive projections in types (fix bug 4709) --- API/API.mli | 2 ++ plugins/extraction/extraction.ml | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/API/API.mli b/API/API.mli index bb24d5768f..d136deb70c 100644 --- a/API/API.mli +++ b/API/API.mli @@ -169,6 +169,8 @@ sig val map : (Constant.t -> Constant.t) -> t -> t val constant : t -> Constant.t val equal : t -> t -> bool + val unfolded : t -> bool + val unfold : t -> t end type evaluable_global_reference = diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml index 3661faadab..996df1a47d 100644 --- a/plugins/extraction/extraction.ml +++ b/plugins/extraction/extraction.ml @@ -295,7 +295,11 @@ let rec extract_type env db j c args = | Ind ((kn,i),u) -> let s = (extract_ind env kn).ind_packets.(i).ip_sign in extract_type_app env db (IndRef (kn,i),s) args - | Case _ | Fix _ | CoFix _ | Proj _ -> Tunknown + | Proj (p,t) -> + (* Let's try to reduce, if it hasn't already been done. *) + if Projection.unfolded p then Tunknown + else extract_type env db j (Term.mkProj (Projection.unfold p, t)) args + | Case _ | Fix _ | CoFix _ -> Tunknown | _ -> assert false (*s Auxiliary function dealing with type application. -- cgit v1.2.3