]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_unification/coercGraph.ml
dded missing catch for coercions
[helm.git] / helm / ocaml / cic_unification / coercGraph.ml
index 469e334a7358e0b7dcbb03ea32607690a0d32fe5..b3bc8d8b0e7ba5b94284102bfc4a68c9db1941bb 100644 (file)
@@ -29,7 +29,7 @@ type coercion_search_result =
   | SomeCoercion of Cic.term
   | NoCoercion
   | NotMetaClosed
-  | NotHandled of string
+  | NotHandled of string Lazy.t
 
 let debug = false
 let debug_print s = if debug then prerr_endline (Lazy.force s) else ()
@@ -67,13 +67,19 @@ let look_for_coercion src tgt =
  * (source, list of coercions to follow, target)
  *)
 let get_closure_coercions src tgt uri coercions =
+  let eq_carr s t = 
+    try
+      CoercDb.eq_carr s t
+    with
+    | CoercDb.EqCarrNotImplemented _ | CoercDb.EqCarrOnNonMetaClosed -> false
+  in
   match src,tgt with
   | CoercDb.Uri _, CoercDb.Uri _ ->
       let c_from_tgt = 
-        List.filter (fun (f,_,_) -> CoercDb.eq_carr f tgt) coercions 
+        List.filter (fun (f,_,_) -> eq_carr f tgt) coercions 
       in
       let c_to_src = 
-        List.filter (fun (_,t,_) -> CoercDb.eq_carr t src) coercions 
+        List.filter (fun (_,t,_) -> eq_carr t src) coercions 
       in
         (List.map (fun (_,t,u) -> src,[uri; u],t) c_from_tgt) @
         (List.map (fun (s,_,u) -> s,[u; uri],tgt) c_to_src) @
@@ -115,7 +121,7 @@ let generate_composite_closure c1 c2 univ =
       CicTypeChecker.type_of_aux' [] [] c univ
     with CicTypeChecker.TypeCheckerFailure s as exn ->
       debug_print (lazy (sprintf "Generated composite coercion:\n%s\n%s" 
-        (CicPp.ppterm c) s));
+        (CicPp.ppterm c) (Lazy.force s)));
       raise exn
   in
   let cleaned_ty =