]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaDisambiguator.ml
ocaml 3.09 transition
[helm.git] / helm / matita / matitaDisambiguator.ml
index cd4d42420de20f6ddc815d7bbbaa80a60f43955f..24a8355237b7d1e4a7b81d4b58068a01537bc22d 100644 (file)
@@ -28,6 +28,7 @@ open Printf
 open MatitaTypes
 
 exception Ambiguous_input
+exception DisambiguationError of string Lazy.t list list
 
 type choose_uris_callback =
   id:string -> UriManager.uri list -> UriManager.uri list
@@ -103,18 +104,23 @@ let disambiguate_thing ~aliases ~universe
    else
     drop_aliases_and_clear_diff res
   in
-  let rec aux =
+  let rec aux errors =
     function
-    | [ pass ] -> set_aliases pass (try_pass pass)
+    | [ pass ] ->
+        (try
+          set_aliases pass (try_pass pass)
+         with Disambiguate.NoWellTypedInterpretation newerrors ->
+          raise (DisambiguationError (errors @ [newerrors])))
     | hd :: tl ->
         (try
           set_aliases hd (try_pass hd)
-        with Disambiguate.NoWellTypedInterpretation -> aux tl)
+        with Disambiguate.NoWellTypedInterpretation newerrors ->
+         aux (errors @ [newerrors]) tl)
     | [] -> assert false
   in
   let saved_use_coercions = !CoercDb.use_coercions in
   try
-    let res = aux passes in
+    let res = aux [] passes in
     CoercDb.use_coercions := saved_use_coercions;
     res
   with exn ->
@@ -135,10 +141,10 @@ type disambiguator_thing =
  }
 
 let disambiguate_thing =
- let profiler = CicUtil.profile "disambiguate_thing" in
+ let profiler = HExtlib.profile "disambiguate_thing" in
   { do_it =
      fun ~aliases ~universe ~f ~drop_aliases ~drop_aliases_and_clear_diff thing
-     -> profiler.CicUtil.profile
+     -> profiler.HExtlib.profile
          (disambiguate_thing ~aliases ~universe ~f ~drop_aliases
            ~drop_aliases_and_clear_diff) thing
   }