From f54192a50eaf14852e1462f24e4168aa8a8545fe Mon Sep 17 00:00:00 2001 From: Maxime Dénès Date: Fri, 20 Jul 2018 18:01:18 +0200 Subject: Coercions cleanup: use GlobRef.t instead of constr --- plugins/firstorder/ground.ml | 11 +++++------ plugins/ssr/ssrvernac.ml4 | 8 +++----- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/firstorder/ground.ml b/plugins/firstorder/ground.ml index 4e3ba57308..3901a951f0 100644 --- a/plugins/firstorder/ground.ml +++ b/plugins/firstorder/ground.ml @@ -13,17 +13,16 @@ open Formula open Sequent open Rules open Instances -open Constr open Tacmach.New open Tacticals.New +open Globnames let update_flags ()= let predref=ref Names.Cpred.empty in - let f coe= - try - let kn= fst (destConst (Classops.get_coercion_value coe)) in - predref:=Names.Cpred.add kn !predref - with DestKO -> () + let f coe = + match coe.Classops.coe_value with + | ConstRef c -> predref := Names.Cpred.add c !predref + | _ -> () in List.iter f (Classops.coercions ()); red_flags:= diff --git a/plugins/ssr/ssrvernac.ml4 b/plugins/ssr/ssrvernac.ml4 index 7ce2dd64af..8ce0316f53 100644 --- a/plugins/ssr/ssrvernac.ml4 +++ b/plugins/ssr/ssrvernac.ml4 @@ -24,7 +24,6 @@ open Ltac_plugin open Notation_ops open Notation_term open Glob_term -open Globnames open Stdarg open Genarg open Decl_kinds @@ -359,13 +358,12 @@ let coerce_search_pattern_to_sort hpat = true, cp with _ -> false, [] in let coerce hp coe_index = - let coe = Classops.get_coercion_value coe_index in + let coe_ref = coe_index.Classops.coe_value in try - let coe_ref = global_of_constr coe in let n_imps = Option.get (Classops.hide_coercion coe_ref) in mkPApp (Pattern.PRef coe_ref) n_imps [|hp|] - with _ -> - errorstrm (str "need explicit coercion " ++ pr_constr_env env sigma coe ++ spc () + with Not_found | Option.IsNone -> + errorstrm (str "need explicit coercion " ++ pr_global coe_ref ++ spc () ++ str "to interpret head search pattern as type") in filter_head, List.fold_left coerce hpat' coe_path -- cgit v1.2.3 From baf8b6e100c49635c56308f17275b963d4f5253c Mon Sep 17 00:00:00 2001 From: Maxime Dénès Date: Thu, 26 Jul 2018 14:40:06 +0200 Subject: Replace iter + ref by fold_left --- plugins/firstorder/ground.ml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/firstorder/ground.ml b/plugins/firstorder/ground.ml index 3901a951f0..516b04ea21 100644 --- a/plugins/firstorder/ground.ml +++ b/plugins/firstorder/ground.ml @@ -18,17 +18,16 @@ open Tacticals.New open Globnames let update_flags ()= - let predref=ref Names.Cpred.empty in - let f coe = + let f acc coe = match coe.Classops.coe_value with - | ConstRef c -> predref := Names.Cpred.add c !predref - | _ -> () + | ConstRef c -> Names.Cpred.add c acc + | _ -> acc in - List.iter f (Classops.coercions ()); + let pred = List.fold_left f Names.Cpred.empty (Classops.coercions ()) in red_flags:= CClosure.RedFlags.red_add_transparent CClosure.betaiotazeta - (Names.Id.Pred.full,Names.Cpred.complement !predref) + (Names.Id.Pred.full,Names.Cpred.complement pred) let ground_tac solver startseq = Proofview.Goal.enter begin fun gl -> -- cgit v1.2.3