diff options
| author | Pierre-Marie Pédrot | 2017-02-22 13:44:16 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2017-02-22 13:44:16 +0100 |
| commit | 38c773f2053dd5ba27ae889bb4299ed90b9cc319 (patch) | |
| tree | 23eefe646b197c3005946e812cdc4795e7f5c5f4 | |
| parent | d9d8977cf213f0d4b2e8d324c759c23df58ba457 (diff) | |
| parent | 27e8d8857ea5435ccec9eddd6c34324de82afd32 (diff) | |
Merge branch 'v8.6'
| -rw-r--r-- | interp/constrintern.ml | 3 | ||||
| -rw-r--r-- | interp/topconstr.ml | 11 | ||||
| -rw-r--r-- | ltac/ltac_plugin.ml | 0 | ||||
| -rw-r--r-- | ltac/ltac_plugin.mli | 0 | ||||
| -rw-r--r-- | plugins/ltac/ltac_plugin.mlpack | 1 | ||||
| -rw-r--r-- | test-suite/bugs/closed/5346.v | 29 | ||||
| -rw-r--r-- | tools/gallina-db.el | 2 | ||||
| -rw-r--r-- | vernac/record.ml | 3 |
8 files changed, 43 insertions, 6 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml index c102d8e117..3ed8733df5 100644 --- a/interp/constrintern.ml +++ b/interp/constrintern.ml @@ -1591,7 +1591,8 @@ let internalize globalenv env allow_patvar (_, ntnvars as lvar) c = let idl_tmp = Array.map (fun ((loc,id),bl,ty,_) -> let (env',rbl) = List.fold_left intern_local_binder (env,[]) bl in - let rbl = List.map (function BDRawDef a -> a | BDPattern _ -> assert false) rbl in + let rbl = List.map (function BDRawDef a -> a | BDPattern _ -> + Loc.raise ~loc (Stream.Error "pattern with quote not allowed after cofix")) rbl in (List.rev rbl, intern_type env' ty,env')) dl in let idl = Array.map2 (fun (_,_,_,bd) (b,c,env') -> diff --git a/interp/topconstr.ml b/interp/topconstr.ml index 407cec0842..fd57b70ca9 100644 --- a/interp/topconstr.ml +++ b/interp/topconstr.ml @@ -60,6 +60,9 @@ let rec cases_pattern_fold_names f a = function | CPatPrim _ | CPatAtom _ -> a | CPatCast _ -> assert false +let ids_of_pattern = + cases_pattern_fold_names Id.Set.add Id.Set.empty + let ids_of_pattern_list = List.fold_left (Loc.located_fold_left @@ -173,7 +176,8 @@ let split_at_annot bl na = (List.rev ans, LocalRawAssum (r, k, t) :: rest) end | LocalRawDef _ as x :: rest -> aux (x :: acc) rest - | LocalPattern _ :: rest -> assert false + | LocalPattern (loc,_,_) :: rest -> + Loc.raise ~loc (Stream.Error "pattern with quote not allowed after fix") | [] -> user_err ~loc (str "No parameter named " ++ Nameops.pr_id id ++ str".") @@ -196,8 +200,9 @@ let map_local_binders f g e bl = (map_binder g e nal, LocalRawAssum(nal,k,f e ty)::bl) | LocalRawDef((loc,na),ty) -> (name_fold g na e, LocalRawDef((loc,na),f e ty)::bl) - | LocalPattern _ -> - assert false in + | LocalPattern (loc,pat,t) -> + let ids = ids_of_pattern pat in + (Id.Set.fold g ids e, LocalPattern (loc,pat,Option.map (f e) t)::bl) in let (e,rbl) = List.fold_left h (e,[]) bl in (e, List.rev rbl) diff --git a/ltac/ltac_plugin.ml b/ltac/ltac_plugin.ml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/ltac/ltac_plugin.ml diff --git a/ltac/ltac_plugin.mli b/ltac/ltac_plugin.mli new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/ltac/ltac_plugin.mli diff --git a/plugins/ltac/ltac_plugin.mlpack b/plugins/ltac/ltac_plugin.mlpack index af1c7149da..b6e2cecd1c 100644 --- a/plugins/ltac/ltac_plugin.mlpack +++ b/plugins/ltac/ltac_plugin.mlpack @@ -25,3 +25,4 @@ Tauto G_eqdecide G_tactic G_ltac +Ltac_plugin diff --git a/test-suite/bugs/closed/5346.v b/test-suite/bugs/closed/5346.v new file mode 100644 index 0000000000..0118c18704 --- /dev/null +++ b/test-suite/bugs/closed/5346.v @@ -0,0 +1,29 @@ +Inductive comp : Type -> Type := +| Ret {T} : forall (v:T), comp T +| Bind {T T'} : forall (p: comp T') (p': T' -> comp T), comp T. + +Notation "'do' x .. y <- p1 ; p2" := + (Bind p1 (fun x => .. (fun y => p2) ..)) + (at level 60, right associativity, + x binder, y binder). + +Definition Fst1 A B (p: comp (A*B)) : comp A := + do '(a, b) <- p; + Ret a. + +Definition Fst2 A B (p: comp (A*B)) : comp A := + match tt with + | _ => Bind p (fun '(a, b) => Ret a) + end. + +Definition Fst3 A B (p: comp (A*B)) : comp A := + match tt with + | _ => do a <- p; + Ret (fst a) + end. + +Definition Fst A B (p: comp (A * B)) : comp A := + match tt with + | _ => do '(a, b) <- p; + Ret a + end. diff --git a/tools/gallina-db.el b/tools/gallina-db.el index baabebb13a..9664f69f8b 100644 --- a/tools/gallina-db.el +++ b/tools/gallina-db.el @@ -163,7 +163,7 @@ for DB structure." (defun coq-sort-menu-entries (menu) (sort menu - '(lambda (x y) (string< + (lambda (x y) (string< (downcase (elt x 0)) (downcase (elt y 0)))))) diff --git a/vernac/record.ml b/vernac/record.ml index d5faafaf89..b494430c28 100644 --- a/vernac/record.ml +++ b/vernac/record.ml @@ -110,7 +110,8 @@ let typecheck_params_and_fields def id pl t ps nots fs = List.iter (function LocalRawDef (b, _) -> error default_binder_kind b | LocalRawAssum (ls, bk, ce) -> List.iter (error bk) ls - | LocalPattern _ -> assert false) ps + | LocalPattern (loc,_,_) -> + Loc.raise ~loc (Stream.Error "pattern with quote not allowed in record parameters.")) ps in let impls_env, ((env1,newps), imps) = interp_context_evars env0 evars ps in let t', template = match t with |
