aboutsummaryrefslogtreecommitdiffhomepage
path: root/checker
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2018-01-25 17:46:00 +0100
committerGravatar Maxime Dénès <mail@maximedenes.fr>2018-01-25 17:48:30 +0100
commitc695e5adb3cb5492d412d933b1dd7901dc6676af (patch)
treefd1c628f2c5472f4484cde8f010eeb3b10027f9f /checker
parentd0e05a1964fb2af093ac2a15a75bb84d342bf1ad (diff)
[checker] Better error message for bad recursive trees
Diffstat (limited to 'checker')
-rw-r--r--checker/indtypes.ml11
1 files changed, 10 insertions, 1 deletions
diff --git a/checker/indtypes.ml b/checker/indtypes.ml
index bb0db8cfe..4de597766 100644
--- a/checker/indtypes.ml
+++ b/checker/indtypes.ml
@@ -502,10 +502,19 @@ let check_positivity_one (env, _,ntypes,_ as ienv) hyps nrecp (_,i as ind) indlc
indlc
in mk_paths (Mrec ind) irecargs
+let prrecarg = function
+ | Norec -> str "Norec"
+ | Mrec (mind,i) ->
+ str "Mrec[" ++ MutInd.debug_print mind ++ pr_comma () ++ int i ++ str "]"
+ | Imbr (mind,i) ->
+ str "Imbr[" ++ MutInd.debug_print mind ++ pr_comma () ++ int i ++ str "]"
+
let check_subtree t1 t2 =
let cmp_labels l1 l2 = l1 == Norec || eq_recarg l1 l2 in
if not (Rtree.equiv eq_recarg cmp_labels t1 t2)
- then failwith "bad recursive trees"
+ then user_err Pp.(str "Bad recursive tree: found " ++ fnl ()
+ ++ Rtree.pp_tree prrecarg t1 ++ fnl () ++ str " when expected " ++ fnl ()
+ ++ Rtree.pp_tree prrecarg t2)
(* if t1=t2 then () else msg_warning (str"TODO: check recursive positions")*)
let check_positivity env_ar mind params nrecp inds =