aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--engine/evd.ml1
-rw-r--r--interp/constrextern.ml11
-rw-r--r--interp/notation.ml3
-rw-r--r--interp/notation.mli3
-rw-r--r--kernel/environ.ml12
-rw-r--r--kernel/environ.mli8
-rw-r--r--lib/feedback.ml104
-rw-r--r--lib/feedback.mli7
-rw-r--r--lib/pp.ml6
-rw-r--r--lib/pp.mli6
-rw-r--r--lib/ppstyle.ml69
-rw-r--r--lib/ppstyle.mli9
-rw-r--r--plugins/extraction/json.ml3
-rw-r--r--pretyping/cases.ml21
-rw-r--r--tactics/auto.ml30
-rw-r--r--tactics/eauto.ml4
-rw-r--r--tactics/hints.ml6
-rw-r--r--tactics/tacticals.ml2
-rw-r--r--test-suite/bugs/closed/4733.v8
-rw-r--r--test-suite/bugs/closed/4785.v2
-rw-r--r--test-suite/bugs/closed/4785_compat_85.v46
-rw-r--r--test-suite/bugs/closed/5145.v10
-rw-r--r--test-suite/bugs/opened/4803.v20
-rw-r--r--test-suite/output/qualification.out3
-rw-r--r--test-suite/output/qualification.v19
-rw-r--r--test-suite/success/CaseInClause.v3
-rw-r--r--test-suite/success/Notations.v7
-rw-r--r--theories/Compat/Coq84.v6
-rw-r--r--theories/Compat/Coq85.v18
-rw-r--r--theories/Lists/List.v1
-rw-r--r--theories/Vectors/VectorDef.v5
-rw-r--r--toplevel/coqtop.ml6
-rw-r--r--toplevel/himsg.ml3
33 files changed, 245 insertions, 217 deletions
diff --git a/engine/evd.ml b/engine/evd.ml
index e9fc74600..69ca45444 100644
--- a/engine/evd.ml
+++ b/engine/evd.ml
@@ -1410,6 +1410,7 @@ let print_env_short env =
let pr_evar_constraints pbs =
let pr_evconstr (pbty, env, t1, t2) =
+ let env = Namegen.make_all_name_different env in
print_env_short env ++ spc () ++ str "|-" ++ spc () ++
print_constr_env env t1 ++ spc () ++
str (match pbty with
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index 4aff82403..3077231be 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -149,17 +149,8 @@ let extern_evar loc n l = CEvar (loc,n,l)
For instance, in the debugger the tables of global references
may be inaccurate *)
-let safe_shortest_qualid_of_global vars r =
- try shortest_qualid_of_global vars r
- with Not_found ->
- match r with
- | VarRef v -> make_qualid DirPath.empty v
- | ConstRef c -> make_qualid DirPath.empty Names.(Label.to_id (con_label c))
- | IndRef (i,_) | ConstructRef ((i,_),_) ->
- make_qualid DirPath.empty Names.(Label.to_id (mind_label i))
-
let default_extern_reference loc vars r =
- Qualid (loc,safe_shortest_qualid_of_global vars r)
+ Qualid (loc,shortest_qualid_of_global vars r)
let my_extern_reference = ref default_extern_reference
diff --git a/interp/notation.ml b/interp/notation.ml
index 1bd1bc7d5..948d624a2 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -1012,6 +1012,9 @@ let find_notation_parsing_rules ntn =
try pi3 (String.Map.find ntn !notation_rules)
with Not_found -> anomaly (str "No parsing rule found for " ++ str ntn)
+let get_defined_notations () =
+ String.Set.elements @@ String.Map.domain !notation_rules
+
let add_notation_extra_printing_rule ntn k v =
try
notation_rules :=
diff --git a/interp/notation.mli b/interp/notation.mli
index b47e1975e..2e92a00a8 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -203,6 +203,9 @@ val find_notation_extra_printing_rules : notation -> extra_unparsing_rules
val find_notation_parsing_rules : notation -> notation_grammar
val add_notation_extra_printing_rule : notation -> string -> string -> unit
+(** Returns notations with defined parsing/printing rules *)
+val get_defined_notations : unit -> notation list
+
(** Rem: printing rules for primitive token are canonical *)
val with_notation_protection : ('a -> 'b) -> 'a -> 'b
diff --git a/kernel/environ.ml b/kernel/environ.ml
index 1d44cac5b..4a543f195 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -502,18 +502,6 @@ let apply_to_hyp ctxt id f =
| None -> raise Hyp_not_found
in aux [] ctxt
-let apply_to_hyp_and_dependent_on ctxt id f g =
- let rec aux sign =
- match match_named_context_val sign with
- | Some (d, v, sign) ->
- if Id.equal (get_id d) id then
- push_named_context_val (f d sign) sign
- else
- let sign = aux sign in
- push_named_context_val (g d sign) sign
- | None -> raise Hyp_not_found
- in aux ctxt
-
(* To be used in Logic.clear_hyps *)
let remove_hyps ids check_context check_value ctxt =
let rec remove_hyps ctxt = match match_named_context_val ctxt with
diff --git a/kernel/environ.mli b/kernel/environ.mli
index e23333c06..ea570cb4a 100644
--- a/kernel/environ.mli
+++ b/kernel/environ.mli
@@ -264,14 +264,6 @@ val apply_to_hyp : named_context_val -> variable ->
(Context.Named.t -> Context.Named.Declaration.t -> Context.Named.t -> Context.Named.Declaration.t) ->
named_context_val
-(** [apply_to_hyp_and_dependent_on sign id f g] split [sign] into
- [tail::(id,_,_)::head] and
- return [(g tail)::(f (id,_,_))::head]. *)
-val apply_to_hyp_and_dependent_on : named_context_val -> variable ->
- (Context.Named.Declaration.t -> named_context_val -> Context.Named.Declaration.t) ->
- (Context.Named.Declaration.t -> named_context_val -> Context.Named.Declaration.t) ->
- named_context_val
-
val remove_hyps : Id.Set.t -> (Context.Named.Declaration.t -> Context.Named.Declaration.t) -> (Pre_env.lazy_val -> Pre_env.lazy_val) -> named_context_val -> named_context_val
diff --git a/lib/feedback.ml b/lib/feedback.ml
index dd1ca2af3..44b3ee35d 100644
--- a/lib/feedback.ml
+++ b/lib/feedback.ml
@@ -52,8 +52,7 @@ open Pp_control
type logger = ?loc:Loc.t -> level -> std_ppcmds -> unit
-let msgnl_with fmt strm = msg_with fmt (strm ++ fnl ())
-let msgnl strm = msgnl_with !std_ft strm
+let msgnl_with ?pp_tag fmt strm = msg_with ?pp_tag fmt (strm ++ fnl ())
(* XXX: This is really painful! *)
module Emacs = struct
@@ -75,45 +74,100 @@ end
open Emacs
-let dbg_str = str "Debug:" ++ spc ()
+let dbg_str = tag Ppstyle.(Tag.inj debug_tag tag) (str "Debug:") ++ spc ()
let info_str = mt ()
-let warn_str = str "Warning:" ++ spc ()
-let err_str = str "Error:" ++ spc ()
+let warn_str = tag Ppstyle.(Tag.inj warning_tag tag) (str "Warning:") ++ spc ()
+let err_str = tag Ppstyle.(Tag.inj error_tag tag) (str "Error:" ) ++ spc ()
let make_body quoter info ?loc s =
let loc = Option.cata Pp.pr_loc (Pp.mt ()) loc in
quoter (hov 0 (loc ++ info ++ s))
(* Generic logger *)
-let gen_logger dbg err ?loc level msg = match level with
- | Debug -> msgnl (make_body dbg dbg_str ?loc msg)
- | Info -> msgnl (make_body dbg info_str ?loc msg)
- (* XXX: What to do with loc here? *)
- | Notice -> msgnl msg
+let gen_logger dbg err ?pp_tag ?loc level msg = match level with
+ | Debug -> msgnl_with ?pp_tag !std_ft (make_body dbg dbg_str ?loc msg)
+ | Info -> msgnl_with ?pp_tag !std_ft (make_body dbg info_str ?loc msg)
+ | Notice -> msgnl_with ?pp_tag !std_ft msg
| Warning -> Flags.if_warn (fun () ->
- msgnl_with !err_ft (make_body err warn_str ?loc msg)) ()
- | Error -> msgnl_with !err_ft (make_body err err_str ?loc msg)
+ msgnl_with ?pp_tag !err_ft (make_body err warn_str ?loc msg)) ()
+ | Error -> msgnl_with ?pp_tag !err_ft (make_body err err_str ?loc msg)
-(** Standard loggers *)
-let std_logger = gen_logger (fun x -> x) (fun x -> x)
+(* We provide a generic clear_log_backend callback for backends
+ wanting to do clenaup after the print.
+*)
+let std_logger_tag = ref None
+let std_logger_cleanup = ref (fun () -> ())
-(* Color logger *)
-let color_terminal_logger ?loc level strm =
- let msg = Ppstyle.color_msg in
- match level with
- | Debug -> msg ?loc ~header:("Debug", Ppstyle.debug_tag) !std_ft strm
- | Info -> msg ?loc !std_ft strm
- | Notice -> msg ?loc !std_ft strm
- | Warning -> Flags.if_warn (fun () ->
- msg ?loc ~header:("Warning", Ppstyle.warning_tag) !err_ft strm) ()
- | Error -> msg ?loc ~header:("Error", Ppstyle.error_tag) !err_ft strm
+let std_logger ?loc level msg =
+ gen_logger (fun x -> x) (fun x -> x) ?pp_tag:!std_logger_tag ?loc level msg;
+ !std_logger_cleanup ()
(* Rules for emacs:
- Debug/info: emacs_quote_info
- Warning/Error: emacs_quote_err
- Notice: unquoted
+
+ Note the inconsistency.
*)
-let emacs_logger = gen_logger emacs_quote_info emacs_quote_err
+let emacs_logger = gen_logger emacs_quote_info emacs_quote_err ?pp_tag:None
+
+(** Color logging. Moved from pp_style, it may need some more refactoring *)
+
+(** Not thread-safe. We should put a lock somewhere if we print from
+ different threads. Do we? *)
+let make_style_stack () =
+ (** Default tag is to reset everything *)
+ let empty = Terminal.make () in
+ let default_tag = Terminal.({
+ fg_color = Some `DEFAULT;
+ bg_color = Some `DEFAULT;
+ bold = Some false;
+ italic = Some false;
+ underline = Some false;
+ negative = Some false;
+ })
+ in
+ let style_stack = ref [] in
+ let peek () = match !style_stack with
+ | [] -> default_tag (** Anomalous case, but for robustness *)
+ | st :: _ -> st
+ in
+ let push tag =
+ let style = match Ppstyle.get_style tag with
+ | None -> empty
+ | Some st -> st
+ in
+ (** Use the merging of the latest tag and the one being currently pushed.
+ This may be useful if for instance the latest tag changes the background and
+ the current one the foreground, so that the two effects are additioned. *)
+ let style = Terminal.merge (peek ()) style in
+ style_stack := style :: !style_stack;
+ Terminal.eval style
+ in
+ let pop _ = match !style_stack with
+ | [] -> (** Something went wrong, we fallback *)
+ Terminal.eval default_tag
+ | _ :: rem -> style_stack := rem;
+ Terminal.eval (peek ())
+ in
+ let clear () = style_stack := [] in
+ push, pop, clear
+
+let init_color_output () =
+ let open Pp_control in
+ let push_tag, pop_tag, clear_tag = make_style_stack () in
+ std_logger_cleanup := clear_tag;
+ std_logger_tag := Some Ppstyle.pp_tag;
+ let tag_handler = {
+ Format.mark_open_tag = push_tag;
+ Format.mark_close_tag = pop_tag;
+ Format.print_open_tag = ignore;
+ Format.print_close_tag = ignore;
+ } in
+ Format.pp_set_mark_tags !std_ft true;
+ Format.pp_set_mark_tags !err_ft true;
+ Format.pp_set_formatter_tag_functions !std_ft tag_handler;
+ Format.pp_set_formatter_tag_functions !err_ft tag_handler
let logger = ref std_logger
let set_logger l = logger := l
diff --git a/lib/feedback.mli b/lib/feedback.mli
index 48b1c19a6..5160bd5bc 100644
--- a/lib/feedback.mli
+++ b/lib/feedback.mli
@@ -72,11 +72,8 @@ val set_logger : logger -> unit
(** [std_logger] standard logger to [stdout/stderr] *)
val std_logger : logger
-val color_terminal_logger : logger
-(* This logger will apply the proper {!Pp_style} tags, and in
- particular use the formatters {!Pp_control.std_ft} and
- {!Pp_control.err_ft} to display those messages. Be careful this is
- not compatible with the Emacs mode! *)
+(** [init_color_output ()] Enable color in the std_logger *)
+val init_color_output : unit -> unit
(** [feedback_logger] will produce feedback messages instead IO events *)
val feedback_logger : logger
diff --git a/lib/pp.ml b/lib/pp.ml
index 8291e7462..552049802 100644
--- a/lib/pp.ml
+++ b/lib/pp.ml
@@ -344,8 +344,8 @@ let pp_with ?pp_tag ft strm =
pp_dirs ?pp_tag ft (Glue.atom (Ppdir_ppcmds strm))
(* pretty printing functions WITH FLUSH *)
-let msg_with ft strm =
- pp_dirs ft (Glue.atom(Ppdir_ppcmds strm) ++ Glue.atom(Ppdir_print_flush))
+let msg_with ?pp_tag ft strm =
+ pp_dirs ?pp_tag ft (Glue.atom(Ppdir_ppcmds strm) ++ Glue.atom(Ppdir_print_flush))
(* If mixing some output and a goal display, please use msg_warning,
so that interfaces (proofgeneral for example) can easily dispatch
@@ -353,7 +353,7 @@ let msg_with ft strm =
(** Output to a string formatter *)
let string_of_ppcmds c =
- Format.fprintf Format.str_formatter "@[%a@]" msg_with c;
+ Format.fprintf Format.str_formatter "@[%a@]" (msg_with ?pp_tag:None) c;
Format.flush_str_formatter ()
(* Copy paste from Util *)
diff --git a/lib/pp.mli b/lib/pp.mli
index f607e99db..8342a983d 100644
--- a/lib/pp.mli
+++ b/lib/pp.mli
@@ -172,8 +172,8 @@ val pr_loc : Loc.t -> std_ppcmds
(** FIXME: These ignore the logging settings and call [Format] directly *)
type tag_handler = Tag.t -> Format.tag
-(** [msg_with fmt pp] Print [pp] to [fmt] and flush [fmt] *)
-val msg_with : Format.formatter -> std_ppcmds -> unit
+(** [msg_with ?pp_tag fmt pp] Print [pp] to [fmt] and flush [fmt] *)
+val msg_with : ?pp_tag:tag_handler -> Format.formatter -> std_ppcmds -> unit
-(** [msg_with fmt pp] Print [pp] to [fmt] and don't flush [fmt] *)
+(** [msg_with ?pp_tag fmt pp] Print [pp] to [fmt] and don't flush [fmt] *)
val pp_with : ?pp_tag:tag_handler -> Format.formatter -> std_ppcmds -> unit
diff --git a/lib/ppstyle.ml b/lib/ppstyle.ml
index ecfaa822c..aa47c5167 100644
--- a/lib/ppstyle.ml
+++ b/lib/ppstyle.ml
@@ -56,41 +56,6 @@ let default = Terminal.({
let empty = Terminal.make ()
-let make_style_stack style_tags =
- (** Not thread-safe. We should put a lock somewhere if we print from
- different threads. Do we? *)
- let style_stack = ref [] in
- let peek () = match !style_stack with
- | [] -> default (** Anomalous case, but for robustness *)
- | st :: _ -> st
- in
- let push tag =
- let style =
- try
- begin match String.Map.find tag style_tags with
- | None -> empty
- | Some st -> st
- end
- with Not_found -> empty
- in
- (** Use the merging of the latest tag and the one being currently pushed.
- This may be useful if for instance the latest tag changes the background and
- the current one the foreground, so that the two effects are additioned. *)
- let style = Terminal.merge (peek ()) style in
- let () = style_stack := style :: !style_stack in
- Terminal.eval style
- in
- let pop _ = match !style_stack with
- | [] ->
- (** Something went wrong, we fallback *)
- Terminal.eval default
- | _ :: rem ->
- let () = style_stack := rem in
- Terminal.eval (peek ())
- in
- let clear () = style_stack := [] in
- push, pop, clear
-
let error_tag =
let style = Terminal.make ~bold:true ~fg_color:`WHITE ~bg_color:`RED () in
make ~style ["message"; "error"]
@@ -106,37 +71,3 @@ let debug_tag =
let pp_tag t = match Pp.Tag.prj t tag with
| None -> ""
| Some key -> key
-
-let clear_tag_fn = ref (fun () -> ())
-
-let init_color_output () =
- let push_tag, pop_tag, clear_tag = make_style_stack !tags in
- clear_tag_fn := clear_tag;
- let tag_handler = {
- Format.mark_open_tag = push_tag;
- Format.mark_close_tag = pop_tag;
- Format.print_open_tag = ignore;
- Format.print_close_tag = ignore;
- } in
- let open Pp_control in
- Format.pp_set_mark_tags !std_ft true;
- Format.pp_set_mark_tags !err_ft true;
- Format.pp_set_formatter_tag_functions !std_ft tag_handler;
- Format.pp_set_formatter_tag_functions !err_ft tag_handler
-
-let color_msg ?loc ?header ft strm =
- let pptag = tag in
- let open Pp in
- let ploc = Option.cata Pp.pr_loc (Pp.mt ()) loc in
- let strm = match header with
- | None -> hov 0 (ploc ++ strm)
- | Some (h, t) ->
- let tag = Pp.Tag.inj t pptag in
- let h = Pp.tag tag (str h ++ str ":") in
- hov 0 (ploc ++ h ++ spc () ++ strm)
- in
- pp_with ~pp_tag ft strm;
- Format.pp_print_newline ft ();
- Format.pp_print_flush ft ();
- (** In case something went wrong, we reset the stack *)
- !clear_tag_fn ()
diff --git a/lib/ppstyle.mli b/lib/ppstyle.mli
index b07fcd5d4..d9fd75765 100644
--- a/lib/ppstyle.mli
+++ b/lib/ppstyle.mli
@@ -44,14 +44,7 @@ val parse_config : string -> unit
val dump : unit -> (t * Terminal.style option) list
(** Recover the list of known tags together with their current style. *)
-(** {5 Setting color output} *)
-
-val init_color_output : unit -> unit
-
-val color_msg : ?loc:Loc.t -> ?header:string * Format.tag ->
- Format.formatter -> Pp.std_ppcmds -> unit
-(** {!color_msg ?header fmt pp} will format according to the tags
- defined in this file *)
+(** {5 Color output} *)
val pp_tag : Pp.tag_handler
(** Returns the name of a style tag that is understandable by the formatters
diff --git a/plugins/extraction/json.ml b/plugins/extraction/json.ml
index 8874afef3..e43c47d05 100644
--- a/plugins/extraction/json.ml
+++ b/plugins/extraction/json.ml
@@ -142,7 +142,8 @@ let rec json_expr env = function
("what", json_str "fix:item");
("name", json_id fi);
("body", json_function env' ti)
- ]) (Array.map2 (fun a b -> a,b) ids' defs)))
+ ]) (Array.map2 (fun a b -> a,b) ids' defs)));
+ ("for", json_int i);
]
| MLexn s -> json_dict [
("what", json_str "expr:exception");
diff --git a/pretyping/cases.ml b/pretyping/cases.ml
index 02fb515b0..3f01adf7e 100644
--- a/pretyping/cases.ml
+++ b/pretyping/cases.ml
@@ -1925,7 +1925,10 @@ let prepare_predicate_from_arsign_tycon env sigma loc tomatchs arsign c =
* type and 1 assumption for each term not _syntactically_ in an
* inductive type.
- * Each matched term is independently considered dependent or not.
+ * Each matched terms are independently considered dependent or not.
+
+ * A type constraint but no annotation case: we try to specialize the
+ * tycon to make the predicate if it is not closed.
*)
let prepare_predicate loc typing_fun env sigma tomatchs arsign tycon pred =
@@ -1935,14 +1938,14 @@ let prepare_predicate loc typing_fun env sigma tomatchs arsign tycon pred =
| None, Some t when not (noccur_with_meta 0 max_int t) ->
(* If the tycon is not closed w.r.t real variables, we try *)
(* two different strategies *)
- (* First strategy: we build an "inversion" predicate *)
- let sigma1,pred1 = build_inversion_problem loc env sigma tomatchs t in
- (* Optional second strategy: we abstract the tycon wrt to the dependencies *)
- let p2 =
+ (* First strategy: we abstract the tycon wrt to the dependencies *)
+ let p1 =
prepare_predicate_from_arsign_tycon env sigma loc tomatchs arsign t in
- (match p2 with
- | Some (sigma2,pred2) -> [sigma1, pred1; sigma2, pred2]
- | None -> [sigma1, pred1])
+ (* Second strategy: we build an "inversion" predicate *)
+ let sigma2,pred2 = build_inversion_problem loc env sigma tomatchs t in
+ (match p1 with
+ | Some (sigma1,pred1) -> [sigma1, pred1; sigma2, pred2]
+ | None -> [sigma2, pred2])
| None, _ ->
(* No dependent type constraint, or no constraints at all: *)
(* we use two strategies *)
@@ -1957,7 +1960,7 @@ let prepare_predicate loc typing_fun env sigma tomatchs arsign tycon pred =
in
(* First strategy: we build an "inversion" predicate *)
let sigma1,pred1 = build_inversion_problem loc env sigma tomatchs t in
- (* Second strategy: we use the evar or tycon as a non dependent pred *)
+ (* Second strategy: we directly use the evar as a non dependent pred *)
let pred2 = lift (List.length (List.flatten arsign)) t in
[sigma1, pred1; sigma, pred2]
(* Some type annotation *)
diff --git a/tactics/auto.ml b/tactics/auto.ml
index c66fad651..63f85114e 100644
--- a/tactics/auto.ml
+++ b/tactics/auto.ml
@@ -259,31 +259,25 @@ let pr_info_atom (d,pp) =
let pr_info_trace = function
| (Info,_,{contents=(d,Some pp)::l}) ->
- prlist_with_sep fnl pr_info_atom (cleanup_info_trace d [(d,pp)] l)
- | _ -> mt ()
+ Feedback.msg_debug (prlist_with_sep fnl pr_info_atom (cleanup_info_trace d [(d,pp)] l))
+ | _ -> ()
let pr_info_nop = function
- | (Info,_,_) -> str "idtac."
- | _ -> mt ()
+ | (Info,_,_) -> Feedback.msg_debug (str "idtac.")
+ | _ -> ()
let pr_dbg_header = function
- | (Off,_,_) -> mt ()
- | (Debug,0,_) -> str "(* debug trivial : *)"
- | (Debug,_,_) -> str "(* debug auto : *)"
- | (Info,0,_) -> str "(* info trivial : *)"
- | (Info,_,_) -> str "(* info auto : *)"
+ | (Off,_,_) -> ()
+ | (Debug,0,_) -> Feedback.msg_debug (str "(* debug trivial: *)")
+ | (Debug,_,_) -> Feedback.msg_debug (str "(* debug auto: *)")
+ | (Info,0,_) -> Feedback.msg_debug (str "(* info trivial: *)")
+ | (Info,_,_) -> Feedback.msg_debug (str "(* info auto: *)")
let tclTRY_dbg d tac =
- let (level, _, _) = d in
let delay f = Proofview.tclUNIT () >>= fun () -> f () in
- let tac = match level with
- | Off -> tac
- | Debug | Info -> delay (fun () -> Feedback.msg_debug (pr_dbg_header d ++ fnl () ++ pr_info_trace d); tac)
- in
- let after = match level with
- | Info -> delay (fun () -> Feedback.msg_debug (pr_info_nop d); Proofview.tclUNIT ())
- | Off | Debug -> Proofview.tclUNIT ()
- in
+ let tac = delay (fun () -> pr_dbg_header d; tac) >>=
+ fun () -> pr_info_trace d; Proofview.tclUNIT () in
+ let after = delay (fun () -> pr_info_nop d; Proofview.tclUNIT ()) in
Tacticals.New.tclORELSE0 tac after
(**************************************************************************)
diff --git a/tactics/eauto.ml b/tactics/eauto.ml
index e9e00f201..c6b7de32d 100644
--- a/tactics/eauto.ml
+++ b/tactics/eauto.ml
@@ -351,8 +351,8 @@ let pr_info_nop = function
let pr_dbg_header = function
| Off -> ()
- | Debug -> Feedback.msg_debug (str "(* debug eauto : *)")
- | Info -> Feedback.msg_debug (str "(* info eauto : *)")
+ | Debug -> Feedback.msg_debug (str "(* debug eauto: *)")
+ | Info -> Feedback.msg_debug (str "(* info eauto: *)")
let pr_info dbg s =
if dbg != Info then ()
diff --git a/tactics/hints.ml b/tactics/hints.ml
index 7dc40079e..3d5be5441 100644
--- a/tactics/hints.ml
+++ b/tactics/hints.ml
@@ -1299,11 +1299,11 @@ let make_db_list dbnames =
let pr_hint_elt (c, _, _) = pr_constr c
let pr_hint h = match h.obj with
- | Res_pf (c, _) -> (str"apply " ++ pr_hint_elt c)
- | ERes_pf (c, _) -> (str"eapply " ++ pr_hint_elt c)
+ | Res_pf (c, _) -> (str"simple apply " ++ pr_hint_elt c)
+ | ERes_pf (c, _) -> (str"simple eapply " ++ pr_hint_elt c)
| Give_exact (c, _) -> (str"exact " ++ pr_hint_elt c)
| Res_pf_THEN_trivial_fail (c, _) ->
- (str"apply " ++ pr_hint_elt c ++ str" ; trivial")
+ (str"simple apply " ++ pr_hint_elt c ++ str" ; trivial")
| Unfold_nth c -> (str"unfold " ++ pr_evaluable_reference c)
| Extern tac ->
let env =
diff --git a/tactics/tacticals.ml b/tactics/tacticals.ml
index f739488aa..93c04e373 100644
--- a/tactics/tacticals.ml
+++ b/tactics/tacticals.ml
@@ -324,7 +324,7 @@ module New = struct
try
Refiner.catch_failerror e;
tclUNIT ()
- with e -> tclZERO e
+ with e when CErrors.noncritical e -> tclZERO e
(* spiwack: I chose to give the Ltac + the same semantics as
[Proofview.tclOR], however, for consistency with the or-else
diff --git a/test-suite/bugs/closed/4733.v b/test-suite/bugs/closed/4733.v
index ac0653492..a6ebda61c 100644
--- a/test-suite/bugs/closed/4733.v
+++ b/test-suite/bugs/closed/4733.v
@@ -25,16 +25,16 @@ Check [ _ ]%list : list _.
Check [ _ ]%vector : Vector.t _ _.
Check [ _ ; _ ]%list : list _.
Check [ _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser *)
+Check [ _ ; _ ]%mylist : mylist _.
Check [ _ ; _ ; _ ]%list : list _.
Check [ _ ; _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser *)
+Check [ _ ; _ ; _ ]%mylist : mylist _.
Check [ _ ; _ ; _ ; _ ]%list : list _.
Check [ _ ; _ ; _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ; _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser *)
+Check [ _ ; _ ; _ ; _ ]%mylist : mylist _.
Notation " [ x ; y ; .. ; z ] " := (mycons x (mycons y .. (mycons z mynil) ..)) : mylist_scope.
-(* Now these all work, but not so in 8.4. If we get the ability to remove notations, and the above fails can be removed, this section can also just be removed. *)
+(* Now these all work, but not so in 8.4. If we get the ability to remove notations, this section can also just be removed. *)
Check [ ]%mylist : mylist _.
Check [ ]%list : list _.
Check []%vector : Vector.t _ _.
diff --git a/test-suite/bugs/closed/4785.v b/test-suite/bugs/closed/4785.v
index 14af2d91d..c3c97d3f5 100644
--- a/test-suite/bugs/closed/4785.v
+++ b/test-suite/bugs/closed/4785.v
@@ -21,7 +21,7 @@ Delimit Scope mylist_scope with mylist.
Bind Scope mylist_scope with mylist.
Arguments mynil {_}, _.
Arguments mycons {_} _ _.
-Notation " [] " := mynil : mylist_scope.
+Notation " [] " := mynil (compat "8.5") : mylist_scope.
Notation " [ ] " := mynil (format "[ ]") : mylist_scope.
Notation " [ x ] " := (mycons x nil) : mylist_scope.
Notation " [ x ; y ; .. ; z ] " := (mycons x (mycons y .. (mycons z nil) ..)) : mylist_scope.
diff --git a/test-suite/bugs/closed/4785_compat_85.v b/test-suite/bugs/closed/4785_compat_85.v
new file mode 100644
index 000000000..9d65840ac
--- /dev/null
+++ b/test-suite/bugs/closed/4785_compat_85.v
@@ -0,0 +1,46 @@
+(* -*- coq-prog-args: ("-emacs" "-compat" "8.5") -*- *)
+Require Coq.Lists.List Coq.Vectors.Vector.
+Require Coq.Compat.Coq85.
+
+Module A.
+Import Coq.Lists.List Coq.Vectors.Vector.
+Import ListNotations.
+Check [ ]%list : list _.
+Import VectorNotations ListNotations.
+Delimit Scope vector_scope with vector.
+Check [ ]%vector : Vector.t _ _.
+Check []%vector : Vector.t _ _.
+Check [ ]%list : list _.
+Fail Check []%list : list _.
+
+Goal True.
+ idtac; [ ]. (* Note that vector notations break the [ | .. | ] syntax of Ltac *)
+Abort.
+
+Inductive mylist A := mynil | mycons (x : A) (xs : mylist A).
+Delimit Scope mylist_scope with mylist.
+Bind Scope mylist_scope with mylist.
+Arguments mynil {_}, _.
+Arguments mycons {_} _ _.
+Notation " [] " := mynil (compat "8.5") : mylist_scope.
+Notation " [ ] " := mynil (format "[ ]") : mylist_scope.
+Notation " [ x ] " := (mycons x nil) : mylist_scope.
+Notation " [ x ; y ; .. ; z ] " := (mycons x (mycons y .. (mycons z nil) ..)) : mylist_scope.
+
+Import Coq.Compat.Coq85.
+Locate Module VectorNotations.
+Import VectorDef.VectorNotations.
+
+Check []%vector : Vector.t _ _.
+Check []%mylist : mylist _.
+Check [ ]%mylist : mylist _.
+Check [ ]%list : list _.
+End A.
+
+Module B.
+Import Coq.Compat.Coq85.
+
+Goal True.
+ idtac; []. (* Check that importing the compat file doesn't break the [ | .. | ] syntax of Ltac *)
+Abort.
+End B.
diff --git a/test-suite/bugs/closed/5145.v b/test-suite/bugs/closed/5145.v
new file mode 100644
index 000000000..0533d21e0
--- /dev/null
+++ b/test-suite/bugs/closed/5145.v
@@ -0,0 +1,10 @@
+Class instructions :=
+ {
+ W : Type;
+ ldi : nat -> W
+ }.
+
+Fail Definition foo :=
+ let y2 := ldi 0 in
+ let '(CF, _) := (true, 0) in
+ y2.
diff --git a/test-suite/bugs/opened/4803.v b/test-suite/bugs/opened/4803.v
index 3ca5c095f..4530548b8 100644
--- a/test-suite/bugs/opened/4803.v
+++ b/test-suite/bugs/opened/4803.v
@@ -25,10 +25,24 @@ Check [ _ ]%list : list _.
Check [ _ ]%vector : Vector.t _ _.
Check [ _ ; _ ]%list : list _.
Check [ _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser; it should be added to Compat/Coq84.v *)
+Check [ _ ; _ ]%mylist : mylist _.
Check [ _ ; _ ; _ ]%list : list _.
Check [ _ ; _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser *)
+Check [ _ ; _ ; _ ]%mylist : mylist _.
Check [ _ ; _ ; _ ; _ ]%list : list _.
Check [ _ ; _ ; _ ; _ ]%vector : Vector.t _ _.
-Fail Check [ _ ; _ ; _ ; _ ]%mylist : mylist _. (* ideally, this should work, but that requires removing notations from the parser *)
+Check [ _ ; _ ; _ ; _ ]%mylist : mylist _.
+
+(** Now check that we can add and then remove notations from the parser *)
+(* We should be able to stick some vernacular here to remove [] from the parser *)
+Fail Remove Notation "[]".
+Goal True.
+ (* This should not be a syntax error; before moving this file to closed, uncomment this line. *)
+ (* idtac; []. *)
+ constructor.
+Qed.
+
+Check { _ : _ & _ }.
+Reserved Infix "&" (at level 0).
+Fail Remove Infix "&".
+(* Check { _ : _ & _ }. *)
diff --git a/test-suite/output/qualification.out b/test-suite/output/qualification.out
new file mode 100644
index 000000000..9300c3f54
--- /dev/null
+++ b/test-suite/output/qualification.out
@@ -0,0 +1,3 @@
+File "stdin", line 19, characters 0-7:
+Error: Signature components for label test do not match: expected type
+"Top.M2.t = Top.M2.M.t" but found type "Top.M2.t = Top.M2.t".
diff --git a/test-suite/output/qualification.v b/test-suite/output/qualification.v
new file mode 100644
index 000000000..d39097e2d
--- /dev/null
+++ b/test-suite/output/qualification.v
@@ -0,0 +1,19 @@
+Module Type T1.
+ Parameter t : Type.
+End T1.
+
+Module Type T2.
+ Declare Module M : T1.
+ Parameter t : Type.
+ Parameter test : t = M.t.
+End T2.
+
+Module M1 <: T1.
+ Definition t : Type := bool.
+End M1.
+
+Module M2 <: T2.
+ Module M := M1.
+ Definition t : Type := nat.
+ Lemma test : t = t. Proof. reflexivity. Qed.
+End M2.
diff --git a/test-suite/success/CaseInClause.v b/test-suite/success/CaseInClause.v
index 599b9566c..6424fe92d 100644
--- a/test-suite/success/CaseInClause.v
+++ b/test-suite/success/CaseInClause.v
@@ -24,3 +24,6 @@ Theorem foo : forall (n m : nat) (pf : n = m),
(* Check redundant clause is removed *)
Inductive I : nat * nat -> Type := C : I (0,0).
Check fun x : I (1,1) => match x in I (y,z) return y = z with C => eq_refl end.
+
+(* An example of non-local inference of the type of an impossible case *)
+Check (fun y n (x:Vector.t nat (S n)) => match x with a::_ => a | _ => y end) 2.
diff --git a/test-suite/success/Notations.v b/test-suite/success/Notations.v
index 2f7c62972..30abd961b 100644
--- a/test-suite/success/Notations.v
+++ b/test-suite/success/Notations.v
@@ -58,7 +58,7 @@ Check (fun x:nat*nat => match x with R x y => (x,y) end).
(* Check multi-tokens recursive notations *)
-Local Notation "[ a # ; .. # ; b ]" := (a + .. (b + 0) ..).
+Local Notation "[ a # ; .. # ; b ]" := (a + .. (b + 0) ..).
Check [ 0 ].
Check [ 0 # ; 1 ].
@@ -110,3 +110,8 @@ Goal True -> True. intros H. exact H. Qed.
(* Check absence of collision on ".." in nested notations with ".." *)
Notation "[ a , .. , b ]" := (a, (.. (b,tt) ..)).
+
+(* Check that vector notations do not break Ltac [] (bugs #4785, #4733) *)
+Require Import Coq.Vectors.VectorDef.
+Import VectorNotations.
+Goal True. idtac; []. (* important for test: no space here *) constructor. Qed.
diff --git a/theories/Compat/Coq84.v b/theories/Compat/Coq84.v
index 5eecdc64c..a3e23f91c 100644
--- a/theories/Compat/Coq84.v
+++ b/theories/Compat/Coq84.v
@@ -74,12 +74,6 @@ Coercion sig_of_sigT : sigT >-> sig.
Coercion sigT2_of_sig2 : sig2 >-> sigT2.
Coercion sig2_of_sigT2 : sigT2 >-> sig2.
-(** As per bug #4733 (https://coq.inria.fr/bugs/show_bug.cgi?id=4733), we want the user to be able to create custom list-like notatoins that work in both 8.4 and 8.5. This is necessary. These should become compat 8.4 notations in the relevant files, but these modify the parser (bug #4798), so this cannot happen until that bug is fixed. *)
-Require Coq.Lists.List.
-Require Coq.Vectors.VectorDef.
-Notation "[ x ; .. ; y ]" := (cons x .. (cons y nil) ..) : list_scope.
-Notation "[ x ; .. ; y ]" := (VectorDef.cons _ x _ .. (VectorDef.cons _ y _ (nil _)) ..) : vector_scope.
-
(** In 8.4, the statement of admitted lemmas did not depend on the section
variables. *)
Unset Keep Admitted Variables.
diff --git a/theories/Compat/Coq85.v b/theories/Compat/Coq85.v
index 74b416aae..400753644 100644
--- a/theories/Compat/Coq85.v
+++ b/theories/Compat/Coq85.v
@@ -27,21 +27,3 @@ Global Set Refolding Reduction.
Global Set Typeclasses Legacy Resolution.
Global Set Typeclasses Limit Intros.
Global Unset Typeclasses Filtered Unification.
-
-(** In Coq 8.5, [] meant Vector, and [ ] meant list. Restore this
- behavior, to allow user-defined [] to not override vector
- notations. See https://coq.inria.fr/bugs/show_bug.cgi?id=4785. *)
-
-Require Coq.Lists.List.
-Require Coq.Vectors.VectorDef.
-Module Export Coq.
-Module Export Vectors.
-Module VectorDef.
-Export Coq.Vectors.VectorDef.
-Module VectorNotations.
-Export Coq.Vectors.VectorDef.VectorNotations.
-Notation "[]" := (VectorDef.nil _) : vector_scope.
-End VectorNotations.
-End VectorDef.
-End Vectors.
-End Coq.
diff --git a/theories/Lists/List.v b/theories/Lists/List.v
index fc94d7e25..bf21ffb47 100644
--- a/theories/Lists/List.v
+++ b/theories/Lists/List.v
@@ -27,6 +27,7 @@ Module ListNotations.
Notation "[ ]" := nil (format "[ ]") : list_scope.
Notation "[ x ]" := (cons x nil) : list_scope.
Notation "[ x ; y ; .. ; z ]" := (cons x (cons y .. (cons z nil) ..)) : list_scope.
+Notation "[ x ; .. ; y ]" := (cons x .. (cons y nil) ..) (compat "8.4") : list_scope.
End ListNotations.
Import ListNotations.
diff --git a/theories/Vectors/VectorDef.v b/theories/Vectors/VectorDef.v
index f49b34075..1f8b76cb6 100644
--- a/theories/Vectors/VectorDef.v
+++ b/theories/Vectors/VectorDef.v
@@ -295,11 +295,12 @@ End VECTORLIST.
Module VectorNotations.
Delimit Scope vector_scope with vector.
Notation "[ ]" := [] (format "[ ]") : vector_scope.
+Notation "[]" := [] (compat "8.5") : vector_scope.
Notation "h :: t" := (h :: t) (at level 60, right associativity)
: vector_scope.
Notation "[ x ]" := (x :: []) : vector_scope.
-Notation "[ x ; y ; .. ; z ]" := (cons _ x _ (cons _ y _ .. (cons _ z _ (nil _)) ..)) : vector_scope
-.
+Notation "[ x ; y ; .. ; z ]" := (cons _ x _ (cons _ y _ .. (cons _ z _ (nil _)) ..)) : vector_scope.
+Notation "[ x ; .. ; y ]" := (cons _ x _ .. (cons _ y _ (nil _)) ..) (compat "8.4") : vector_scope.
Notation "v [@ p ]" := (nth v p) (at level 1, format "v [@ p ]") : vector_scope.
Open Scope vector_scope.
End VectorNotations.
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index ebdf804ba..7a67e0951 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -61,8 +61,7 @@ let init_color () =
match colors with
| None ->
(** Default colors *)
- Ppstyle.init_color_output ();
- Feedback.set_logger Feedback.color_terminal_logger
+ Feedback.init_color_output ()
| Some "" ->
(** No color output *)
()
@@ -70,8 +69,7 @@ let init_color () =
(** Overwrite all colors *)
Ppstyle.clear_styles ();
Ppstyle.parse_config s;
- Ppstyle.init_color_output ();
- Feedback.set_logger Feedback.color_terminal_logger
+ Feedback.init_color_output ()
end
let toploop_init = ref begin fun x ->
diff --git a/toplevel/himsg.ml b/toplevel/himsg.ml
index 66781a8c3..f7fafab49 100644
--- a/toplevel/himsg.ml
+++ b/toplevel/himsg.ml
@@ -515,7 +515,8 @@ let explain_cant_find_case_type env sigma c =
let c = Evarutil.nf_evar sigma c in
let env = make_all_name_different env in
let pe = pr_lconstr_env env sigma c in
- str "Cannot infer type of pattern-matching on" ++ ws 1 ++ pe ++ str "."
+ str "Cannot infer the return type of pattern-matching on" ++ ws 1 ++
+ pe ++ str "."
let explain_occur_check env sigma ev rhs =
let rhs = Evarutil.nf_evar sigma rhs in