]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaDisambiguator.ml
ocaml 3.09 transition
[helm.git] / helm / matita / matitaDisambiguator.ml
index 22819536fe31b02ea993b8cf3dcc6185c549b5d2..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 ->