diff options
| author | Pierre-Marie Pédrot | 2017-07-04 14:38:48 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2017-07-04 14:52:37 +0200 |
| commit | 8155ba54ae39dd71c6b8ddff2b2b7353dde9aff8 (patch) | |
| tree | 94b2b61cd034873c537b7991cdbe6312fdad2fb3 /interp | |
| parent | 3e0334dd48b5d0b03046d0aff1a82867dc98d656 (diff) | |
| parent | e0ad7ac11b97f089fa862d2e34409e0a1d77d3a1 (diff) | |
Merge branch 'v8.6'
Diffstat (limited to 'interp')
| -rw-r--r-- | interp/notation.ml | 3 | ||||
| -rw-r--r-- | interp/notation.mli | 2 | ||||
| -rw-r--r-- | interp/notation_ops.ml | 9 |
3 files changed, 11 insertions, 3 deletions
diff --git a/interp/notation.ml b/interp/notation.ml index f2b99513a5..4067a6b945 100644 --- a/interp/notation.ml +++ b/interp/notation.ml @@ -582,11 +582,12 @@ let interpretation_eq (vars1, t1) (vars2, t2) = List.equal var_attributes_eq vars1 vars2 && Notation_ops.eq_notation_constr (List.map fst vars1, List.map fst vars2) t1 t2 -let exists_notation_in_scope scopt ntn r = +let exists_notation_in_scope scopt ntn onlyprint r = let scope = match scopt with Some s -> s | None -> default_scope in try let sc = String.Map.find scope !scope_map in let n = String.Map.find ntn sc.notations in + onlyprint = n.not_onlyprinting && interpretation_eq n.not_interp r with Not_found -> false diff --git a/interp/notation.mli b/interp/notation.mli index a1dcb20345..dd0144e8d0 100644 --- a/interp/notation.mli +++ b/interp/notation.mli @@ -148,7 +148,7 @@ val interp_notation_as_global_reference : ?loc:Loc.t -> (global_reference -> boo (** Checks for already existing notations *) val exists_notation_in_scope : scope_name option -> notation -> - interpretation -> bool + bool -> interpretation -> bool (** Declares and looks for scopes associated to arguments of a global ref *) val declare_arguments_scope : diff --git a/interp/notation_ops.ml b/interp/notation_ops.ml index 1931e81673..5d703011d2 100644 --- a/interp/notation_ops.ml +++ b/interp/notation_ops.ml @@ -22,9 +22,16 @@ open Notation_term (**********************************************************************) (* Utilities *) +(* helper for NVar, NVar case in eq_notation_constr *) +let get_var_ndx id vs = try Some (List.index Id.equal id vs) with Not_found -> None + let rec eq_notation_constr (vars1,vars2 as vars) t1 t2 = match t1, t2 with | NRef gr1, NRef gr2 -> eq_gr gr1 gr2 -| NVar id1, NVar id2 -> Int.equal (List.index Id.equal id1 vars1) (List.index Id.equal id2 vars2) +| NVar id1, NVar id2 -> ( + match (get_var_ndx id1 vars1,get_var_ndx id2 vars2) with + | Some n,Some m -> Int.equal n m + | None ,None -> Id.equal id1 id2 + | _ -> false) | NApp (t1, a1), NApp (t2, a2) -> (eq_notation_constr vars) t1 t2 && List.equal (eq_notation_constr vars) a1 a2 | NHole (_, _, _), NHole (_, _, _) -> true (** FIXME? *) |
