aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--contrib/extraction/extract_env.ml6
-rw-r--r--contrib/extraction/mlutil.ml5
2 files changed, 8 insertions, 3 deletions
diff --git a/contrib/extraction/extract_env.ml b/contrib/extraction/extract_env.ml
index 6969c412a..7b997d48c 100644
--- a/contrib/extraction/extract_env.ml
+++ b/contrib/extraction/extract_env.ml
@@ -165,7 +165,11 @@ let extract_reference r =
if is_ml_extraction r then
print_user_extract r
else
- mSGNL (ToplevelPp.pp_decl (List.find (decl_in_r r) (local_optimize [r])))
+ let d = list_last (local_optimize [r]) in
+ mSGNL (ToplevelPp.pp_decl
+ (if (decl_in_r r d) || d = Dtype([],true) || d = Dtype([],false)
+ then d
+ else List.find (decl_in_r r) (local_optimize [r])))
let _ =
vinterp_add "Extraction"
diff --git a/contrib/extraction/mlutil.ml b/contrib/extraction/mlutil.ml
index 39dc37f07..72e81964b 100644
--- a/contrib/extraction/mlutil.ml
+++ b/contrib/extraction/mlutil.ml
@@ -617,6 +617,8 @@ let rec optimize prm = function
Dglob (r,t) :: (optimize prm l)
else
optimize prm l
+ | (Dtype ([],_) | Dabbrev _ | Dcustom _) as d :: l ->
+ d :: (optimize prm l)
| Dtype ([ids,r,[r0,[t0]]],false) :: l when not (type_mem r t0) ->
(* Detection of informative singleton. *)
add_singleton r0;
@@ -626,6 +628,5 @@ let rec optimize prm = function
let l1,l2 = empty_ind il in
if l2 = [] then l1 @ (optimize prm l)
else l1 @ (Dtype(l2,b) :: (optimize prm l))
- | (Dabbrev _ | Dcustom _) as d :: l ->
- d :: (optimize prm l)
+