diff options
| author | Pierre-Marie Pédrot | 2021-04-23 16:33:27 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2021-04-23 16:33:27 +0200 |
| commit | a0c3ebf4a6357a5140b98b4b40c71133c53d802e (patch) | |
| tree | e01a7875d5e2a608d3c3f06022bdf037d376c713 /interp/smartlocate.ml | |
| parent | 7e576aef5b41837c7faa72a5525ee41bec02babb (diff) | |
| parent | b57538ade048f55b657a8d5642ee08e6e4291126 (diff) | |
Merge PR #13965: [abbreviation] user syntax to set interp scope of argument
Ack-by: JasonGross
Reviewed-by: herbelin
Reviewed-by: jashug
Reviewed-by: jfehrle
Reviewed-by: ppedrot
Diffstat (limited to 'interp/smartlocate.ml')
| -rw-r--r-- | interp/smartlocate.ml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/interp/smartlocate.ml b/interp/smartlocate.ml index 91d05f7317..56b3cd9815 100644 --- a/interp/smartlocate.ml +++ b/interp/smartlocate.ml @@ -33,7 +33,7 @@ let global_of_extended_global_head = function | _ -> raise Not_found in head_of syn_def -let global_of_extended_global = function +let global_of_extended_global_exn = function | TrueGlobal ref -> ref | SynDef kn -> match search_syntactic_definition kn with @@ -45,11 +45,15 @@ let locate_global_with_alias ?(head=false) qid = let ref = Nametab.locate_extended qid in try if head then global_of_extended_global_head ref - else global_of_extended_global ref + else global_of_extended_global_exn ref with Not_found -> user_err ?loc:qid.CAst.loc (pr_qualid qid ++ str " is bound to a notation that does not denote a reference.") +let global_of_extended_global x = + try Some (global_of_extended_global_exn x) + with Not_found -> None + let global_constant_with_alias qid = try match locate_global_with_alias qid with | Names.GlobRef.ConstRef c -> c |
