diff options
| author | Hugo Herbelin | 2019-11-14 12:46:42 +0100 |
|---|---|---|
| committer | Hugo Herbelin | 2020-02-22 22:37:41 +0100 |
| commit | 8d80875d230bd8af5611ec04bced1e5a17d058b0 (patch) | |
| tree | 4283140b14b16c6018135661e1fe214f58bc2310 /interp/constrintern.ml | |
| parent | 32467acf285629c28cbda27d27a8cf248150f2bc (diff) | |
Inherit scopes and implicit sign. in notations for partially applied pattern.
Exception: when the notation is to some @id.
Formerly, this was ignored for all kinds of string notations.
Diffstat (limited to 'interp/constrintern.ml')
| -rw-r--r-- | interp/constrintern.ml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml index 1149cf1f58..1b9b45c3fb 100644 --- a/interp/constrintern.ml +++ b/interp/constrintern.ml @@ -1680,7 +1680,7 @@ let drop_notations_pattern looked_for genv = test_kind top g; Dumpglob.add_glob ?loc:qid.loc g; let (_,argscs) = find_remaining_scopes [] pats g in - Some (g,[],List.map2 (fun x -> in_pat false (x,snd scopes)) argscs pats) + Some (g,[],List.map2 (in_pat_sc scopes) argscs pats) with Not_found -> None and in_pat top scopes pt = let open CAst in @@ -1780,7 +1780,15 @@ let drop_notations_pattern looked_for genv = let (argscs1,argscs2) = find_remaining_scopes pl args g in let pl = List.map2 (fun x -> in_not false loc (x,snd scopes) fullsubst []) argscs1 pl in let pl = add_local_defs_and_check_length loc genv g pl args in - DAst.make ?loc @@ RCPatCstr (g, pl @ List.map (in_pat false scopes) args, []) + let args = List.map2 (fun x -> in_pat false (x,snd scopes)) argscs2 args in + let pat = + if List.length pl = 0 then + (* Convention: if notation is @f, encoded as NApp(Nref g,[]), then + implicit arguments are not inherited *) + RCPatCstr (g, pl @ args, []) + else + RCPatCstr (g, pl, args) in + DAst.make ?loc @@ pat | NList (x,y,iter,terminator,revert) -> if not (List.is_empty args) then user_err ?loc (strbrk "Application of arguments to a recursive notation not supported in patterns."); |
