aboutsummaryrefslogtreecommitdiff
path: root/interp/notation.ml
diff options
context:
space:
mode:
authorcoqbot-app[bot]2020-09-28 16:18:52 +0000
committerGitHub2020-09-28 16:18:52 +0000
commit982c28216f3eb49abfd6b97c69b8fc116c813117 (patch)
tree47edf047d93d4ead9d52afc795c812c34063a503 /interp/notation.ml
parentbd24f72a06343b375ad20aaa5b7296c2ad904a5c (diff)
parenta0090dc6930c1f0c60ca6144d1551019ecbcc837 (diff)
Merge PR #12946: Fixes part 1 of #12908: undetected collision involving a lonely notation at printing time.
Reviewed-by: ejgallego Ack-by: maximedenes
Diffstat (limited to 'interp/notation.ml')
-rw-r--r--interp/notation.ml21
1 files changed, 18 insertions, 3 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index 17ae045187..7e90e15b72 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -1198,10 +1198,25 @@ let rec find_without_delimiters find (ntn_scope,ntn) = function
find_without_delimiters find (ntn_scope,ntn) scopes
end
| LonelyNotationItem ntn' :: scopes ->
- begin match ntn_scope, ntn with
- | LastLonelyNotation, Some ntn when notation_eq ntn ntn' ->
- Some (None, None)
+ begin match ntn with
+ | Some ntn'' when notation_eq ntn' ntn'' ->
+ begin match ntn_scope with
+ | LastLonelyNotation ->
+ (* If the first notation with same string in the visibility stack
+ is the one we want to print, then it can be used without
+ risking a collision *)
+ Some (None, None)
+ | NotationInScope _ ->
+ (* A lonely notation is liable to hide the scoped notation
+ to print, we check if the lonely notation is active to
+ know if the delimiter of the scoped notationis needed *)
+ if find default_scope then
+ find_with_delimiters ntn_scope
+ else
+ find_without_delimiters find (ntn_scope,ntn) scopes
+ end
| _ ->
+ (* A lonely notation which does not interfere with the notation to use *)
find_without_delimiters find (ntn_scope,ntn) scopes
end
| [] ->