aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-12-12 13:27:18 +0100
committerEmilio Jesus Gallego Arias2019-12-12 13:27:18 +0100
commit53459444eb4f6be0c57254cd8ea6272279a410fc (patch)
tree78a3e2784ca73ff78c3603a5154e70e0f2a7a407
parent4a7a5c36802701d0e1b47956bb14cfc9cab99baa (diff)
parent6bff5ed8ef6ef6148e035f80e26e60d050e79c43 (diff)
Merge PR #11276: Fixing #10750: "Print Visibility" raises Not_found on only-printing notations
Ack-by: cpitclaudel Reviewed-by: ejgallego
-rw-r--r--doc/changelog/03-notations/11276-master+fix10750.rst4
-rw-r--r--interp/notation.ml4
-rw-r--r--test-suite/success/Notations2.v7
3 files changed, 14 insertions, 1 deletions
diff --git a/doc/changelog/03-notations/11276-master+fix10750.rst b/doc/changelog/03-notations/11276-master+fix10750.rst
new file mode 100644
index 0000000000..a1b8594f5f
--- /dev/null
+++ b/doc/changelog/03-notations/11276-master+fix10750.rst
@@ -0,0 +1,4 @@
+- **Fixed:**
+ :cmd:`Print Visibility` was failing in the presence of only-printing notations
+ (`#11276 <https://github.com/coq/coq/pull/11276>`_,
+ by Hugo Herbelin, fixing `#10750 <https://github.com/coq/coq/pull/10750>`_).
diff --git a/interp/notation.ml b/interp/notation.ml
index efb826a76e..5dc1658824 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -1872,6 +1872,7 @@ let collect_notations stack =
| SingleNotation ntn ->
if List.mem_f notation_eq ntn knownntn then (all,knownntn)
else
+ try
let { not_interp = (_, r); not_location = (_, df) } =
NotationMap.find ntn (find_scope default_scope).notations in
let all' = match all with
@@ -1879,7 +1880,8 @@ let collect_notations stack =
(s,(df,r)::lonelyntn)::rest
| _ ->
(default_scope,[df,r])::all in
- (all',ntn::knownntn))
+ (all',ntn::knownntn)
+ with Not_found -> (* e.g. if only printing *) (all,knownntn))
([],[]) stack)
let pr_visible_in_scope prglob (scope,ntns) =
diff --git a/test-suite/success/Notations2.v b/test-suite/success/Notations2.v
index d047f7560e..aa439fae12 100644
--- a/test-suite/success/Notations2.v
+++ b/test-suite/success/Notations2.v
@@ -165,3 +165,10 @@ Notation "# x ## t & u" := ((fun x => (x,t)),(fun x => (x,u))) (at level 0, x pa
Check fun y : nat => # (x,z) ## y & y.
End M17.
+
+Module Bug10750.
+
+Notation "#" := 0 (only printing).
+Print Visibility.
+
+End Bug10750.