aboutsummaryrefslogtreecommitdiff
path: root/interp
diff options
context:
space:
mode:
Diffstat (limited to 'interp')
-rw-r--r--interp/notation.ml21
-rw-r--r--interp/notation_ops.ml2
2 files changed, 19 insertions, 4 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
| [] ->
diff --git a/interp/notation_ops.ml b/interp/notation_ops.ml
index 6422e184b5..22531b0016 100644
--- a/interp/notation_ops.ml
+++ b/interp/notation_ops.ml
@@ -187,7 +187,7 @@ let apply_cases_pattern ?loc (ids_disjpat,id) c =
let glob_constr_of_notation_constr_with_binders ?loc g f ?(h=default_binder_status_fun) e nc =
let lt x = DAst.make ?loc x in lt @@ match nc with
| NVar id -> GVar id
- | NApp (a,args) -> let e = h.no e in GApp (f e a, List.map (f e) args)
+ | NApp (a,args) -> let e = h.no e in DAst.get (mkGApp (f e a) (List.map (f e) args))
| NList (x,y,iter,tail,swap) ->
let t = f e tail in let it = f e iter in
let innerl = (ldots_var,t)::(if swap then [y, lt @@ GVar x] else []) in