Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17782: anomaly when trying to disable a non existing custom notation #17891

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,5 @@
- **Fixed:**
Anomaly when trying to disable a non-existent custom notation
(`#17891 <https://github.com/coq/coq/pull/17891>`_,
fixes `#17782 <https://github.com/coq/coq/issues/17782>`_,
by Hugo Herbelin).
13 changes: 8 additions & 5 deletions interp/notation.ml
Expand Up @@ -2497,11 +2497,14 @@ let toggle_notations_in_scope ~on found inscope ntn_pattern ntns =
| _ :: _ as ntn_entries, Some (Inl ntn) ->
(* shortcut *)
List.fold_right (fun ntn_entry ntns ->
NotationMap.add (ntn_entry, ntn)
(toggle_notations_by_interpretation ~on found ntn_pattern
(inscope,(ntn_entry,ntn))
(NotationMap.find (ntn_entry, ntn) ntns))
ntns) ntn_entries ntns
try
NotationMap.add (ntn_entry, ntn)
(toggle_notations_by_interpretation ~on found ntn_pattern
(inscope,(ntn_entry,ntn))
(NotationMap.find (ntn_entry, ntn) ntns))
ntns
with Not_found -> ntns)
ntn_entries ntns
(* Deal with full notations *)
| ntn_entries, ntn_rule -> (* This is the table of notations, not of abbreviations *)
NotationMap.mapi (fun (ntn_entry,ntn_key' as ntn') data ->
Expand Down
3 changes: 3 additions & 0 deletions test-suite/output/activation.out
Expand Up @@ -68,3 +68,6 @@ The following notations have been enabled:
Notation activation.Abbrev.x := 0
0
: nat
File "./output/activation.v", line 44, characters 0-49:
The command has indeed failed with message:
Found no matching notation to enable or disable.
7 changes: 7 additions & 0 deletions test-suite/output/activation.v
Expand Up @@ -37,3 +37,10 @@ Enable Notation x.
Check x.

End Abbrev.

Module Bug17782.

Declare Custom Entry trm.
Fail Disable Notation "'foo' _" (in custom trm).

End Bug17782.