Skip to content

Commit

Permalink
Fixing coq#17782: Not_found to catch on non-existing custom notation …
Browse files Browse the repository at this point in the history
…to disable.
  • Loading branch information
herbelin committed Jul 26, 2023
1 parent 4d3970f commit ead0777
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
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.

0 comments on commit ead0777

Please sign in to comment.