aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CODEOWNERS35
-rw-r--r--CHANGES4
-rw-r--r--Makefile3
-rw-r--r--default.nix2
-rw-r--r--doc/sphinx/addendum/implicit-coercions.rst6
-rw-r--r--pretyping/classops.ml49
-rw-r--r--pretyping/classops.mli4
-rw-r--r--pretyping/coercion.ml9
-rw-r--r--pretyping/inferCumulativity.ml2
-rw-r--r--printing/prettyp.ml18
-rw-r--r--printing/prettyp.mli7
-rw-r--r--test-suite/Makefile3
-rw-r--r--test-suite/bugs/closed/8288.v7
-rw-r--r--test-suite/output/PrintAssumptions.out2
-rw-r--r--test-suite/output/PrintAssumptions.v10
-rw-r--r--test-suite/prerequisite/module_bug7192.v9
-rw-r--r--test-suite/prerequisite/module_bug8416.v2
-rw-r--r--theories/Numbers/Integer/Abstract/ZDivEucl.v2
-rw-r--r--theories/Program/Tactics.v2
-rw-r--r--vernac/assumptions.ml2
-rw-r--r--vernac/vernacentries.ml6
21 files changed, 121 insertions, 63 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 274a0001b1..d9136ee24b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -6,11 +6,23 @@
/.github/ @maximedenes
# Secondary maintainer @Zimmi48
+########## Build system ##########
+
+/Makefile* @gares
+
+/configure* @ejgallego
+
+/META.coq.in @ejgallego
+
+/dev/build/windows @MSoegtropIMC
+# Secondary maintainer @maximedenes
+
########## CI infrastructure ##########
/dev/ci/ @coq/ci-maintainers
/.travis.yml @coq/ci-maintainers
/.gitlab-ci.yml @coq/ci-maintainers
+/Makefile.ci @coq/ci-maintainers
/dev/ci/user-overlays/*.sh @ghost
# Trick to avoid getting review requests
@@ -21,8 +33,7 @@
/dev/ci/*.bat @maximedenes
# Secondary maintainer @SkySkimmer
-/default.nix @Zimmi48
-# Secondary maintainer @vbgl
+*.nix @coq/nix-maintainers
########## Documentation ##########
@@ -43,6 +54,7 @@
# each time someone modifies the dev changelog
/doc/ @coq/doc-maintainers
+/Makefile.doc @coq/doc-maintainers
/man/ @silene
# Secondary maintainer @maximedenes
@@ -302,25 +314,6 @@
/vernac/ @mattam82
# Secondary maintainer @maximedenes
-########## Build system ##########
-
-/Makefile* @gares
-
-/configure* @ejgallego
-
-/META.coq.in @ejgallego
-
-/dev/build/windows @MSoegtropIMC
-# Secondary maintainer @maximedenes
-
-# This file belongs to CI
-/Makefile.ci @ejgallego
-# Secondary maintainer @SkySkimmer
-
-# This file belongs to the doc
-/Makefile.doc @maximedenes
-# Secondary maintainer @silene
-
########## Test suite ##########
/test-suite/Makefile @gares
diff --git a/CHANGES b/CHANGES
index 738c0934d1..81693a8166 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,6 +39,10 @@ Tactics
- Deprecated the Implicit Tactic family of commands.
+- The default program obligation tactic uses a bounded proof search
+ instead of an unbounded and potentially non-terminating one now
+ (source of incompatibility).
+
- The `simple apply` tactic now respects the `Opaque` flag when called from
Ltac (`auto` still does not respect it).
diff --git a/Makefile b/Makefile
index 344f2ee972..aa214d18f1 100644
--- a/Makefile
+++ b/Makefile
@@ -177,6 +177,9 @@ Makefile $(wildcard Makefile.*) config/Makefile : ;
###########################################################################
camldevfiles: $(MERLINFILES) META.coq
+# prevent submake dependency
+META.coq.in $(MERLININFILES): ;
+
.merlin: .merlin.in
cp -a "$<" "$@"
diff --git a/default.nix b/default.nix
index 80dca47f69..6f759f41d1 100644
--- a/default.nix
+++ b/default.nix
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
++ [ ocamlPackages.ounit rsync which ]
)
++ optionals shell (
- [ jq curl git gnupg ] # Dependencies of the merging script
+ [ jq curl gitFull gnupg ] # Dependencies of the merging script
++ (with ocamlPackages; [ merlin ocp-indent ocp-index utop ]) # Dev tools
);
diff --git a/doc/sphinx/addendum/implicit-coercions.rst b/doc/sphinx/addendum/implicit-coercions.rst
index c0c4539564..23cbd76eda 100644
--- a/doc/sphinx/addendum/implicit-coercions.rst
+++ b/doc/sphinx/addendum/implicit-coercions.rst
@@ -325,6 +325,12 @@ Coercions and Modules
This option makes it possible to recover the behavior of the versions of
|Coq| prior to 8.3.
+.. warn:: Coercion used but not in scope: @qualid. If you want to use this coercion, please Import the module that contains it.
+
+ This warning is emitted when typechecking relies on a coercion
+ contained in a module that has not been explicitely imported. It helps
+ migrating code and stop relying on the option above.
+
Examples
--------
diff --git a/pretyping/classops.ml b/pretyping/classops.ml
index 542fb5456c..332ecd2c91 100644
--- a/pretyping/classops.ml
+++ b/pretyping/classops.ml
@@ -16,7 +16,6 @@ open Constr
open Libnames
open Globnames
open Nametab
-open Environ
open Libobject
open Mod_subst
@@ -118,6 +117,9 @@ let class_tab =
let coercion_tab =
ref (CoeTypMap.empty : coe_info_typ CoeTypMap.t)
+let coercions_in_scope =
+ ref Refset_env.empty
+
module ClPairOrd =
struct
type t = cl_index * cl_index
@@ -131,12 +133,13 @@ module ClPairMap = Map.Make(ClPairOrd)
let inheritance_graph =
ref (ClPairMap.empty : inheritance_path ClPairMap.t)
-let freeze _ = (!class_tab, !coercion_tab, !inheritance_graph)
+let freeze _ = (!class_tab, !coercion_tab, !inheritance_graph, !coercions_in_scope)
-let unfreeze (fcl,fco,fig) =
+let unfreeze (fcl,fco,fig,in_scope) =
class_tab:=fcl;
coercion_tab:=fco;
- inheritance_graph:=fig
+ inheritance_graph:=fig;
+ coercions_in_scope:=in_scope
(* ajout de nouveaux "objets" *)
@@ -316,16 +319,16 @@ let lookup_pattern_path_between env (s,t) =
(* rajouter une coercion dans le graphe *)
-let path_printer : (env -> Evd.evar_map -> (Bijint.Index.t * Bijint.Index.t) * inheritance_path -> Pp.t) ref =
- ref (fun _ _ _ -> str "<a class path>")
+let path_printer : ((Bijint.Index.t * Bijint.Index.t) * inheritance_path -> Pp.t) ref =
+ ref (fun _ -> str "<a class path>")
let install_path_printer f = path_printer := f
-let print_path env sigma x = !path_printer env sigma x
+let print_path x = !path_printer x
-let message_ambig env sigma l =
+let message_ambig l =
str"Ambiguous paths:" ++ spc () ++
- prlist_with_sep fnl (fun ijp -> print_path env sigma ijp) l
+ prlist_with_sep fnl print_path l
(* add_coercion_in_graph : coe_index * cl_index * cl_index -> unit
coercion,source,target *)
@@ -339,7 +342,7 @@ let different_class_params i =
| CL_CONST c -> Global.is_polymorphic (ConstRef c)
| _ -> false
-let add_coercion_in_graph env sigma (ic,source,target) =
+let add_coercion_in_graph (ic,source,target) =
let old_inheritance_graph = !inheritance_graph in
let ambig_paths =
(ref [] : ((cl_index * cl_index) * inheritance_path) list ref) in
@@ -381,7 +384,7 @@ let add_coercion_in_graph env sigma (ic,source,target) =
end;
let is_ambig = match !ambig_paths with [] -> false | _ -> true in
if is_ambig && not !Flags.quiet then
- Feedback.msg_info (message_ambig env sigma !ambig_paths)
+ Feedback.msg_info (message_ambig !ambig_paths)
type coercion = {
coercion_type : coe_typ;
@@ -426,7 +429,7 @@ let _ =
optread = (fun () -> !automatically_import_coercions);
optwrite = (:=) automatically_import_coercions }
-let cache_coercion env sigma (_, c) =
+let cache_coercion (_, c) =
let () = add_class c.coercion_source in
let () = add_class c.coercion_target in
let is, _ = class_info c.coercion_source in
@@ -439,15 +442,22 @@ let cache_coercion env sigma (_, c) =
coe_param = c.coercion_params;
} in
let () = add_new_coercion c.coercion_type xf in
- add_coercion_in_graph env sigma (xf,is,it)
+ add_coercion_in_graph (xf,is,it)
let load_coercion _ o =
if !automatically_import_coercions then
- cache_coercion (Global.env ()) Evd.empty o
+ cache_coercion o
+
+let set_coercion_in_scope (_, c) =
+ let r = c.coercion_type in
+ coercions_in_scope := Refset_env.add r !coercions_in_scope
let open_coercion i o =
- if Int.equal i 1 && not !automatically_import_coercions then
- cache_coercion (Global.env ()) Evd.empty o
+ if Int.equal i 1 then begin
+ set_coercion_in_scope o;
+ if not !automatically_import_coercions then
+ cache_coercion o
+ end
let subst_coercion (subst, c) =
let coe = subst_coe_typ subst c.coercion_type in
@@ -492,8 +502,8 @@ let inCoercion : coercion -> obj =
open_function = open_coercion;
load_function = load_coercion;
cache_function = (fun objn ->
- let env = Global.env () in cache_coercion env Evd.empty objn
- );
+ set_coercion_in_scope objn;
+ cache_coercion objn);
subst_function = subst_coercion;
classify_function = classify_coercion;
discharge_function = discharge_coercion }
@@ -553,3 +563,6 @@ let hide_coercion coe =
let coe_info = coercion_info coe in
Some coe_info.coe_param
else None
+
+let is_coercion_in_scope r =
+ Refset_env.mem r !coercions_in_scope
diff --git a/pretyping/classops.mli b/pretyping/classops.mli
index af00c0a8dc..7c4842c8ae 100644
--- a/pretyping/classops.mli
+++ b/pretyping/classops.mli
@@ -99,7 +99,7 @@ val lookup_pattern_path_between :
(**/**)
(* Crade *)
val install_path_printer :
- (env -> evar_map -> (cl_index * cl_index) * inheritance_path -> Pp.t) -> unit
+ ((cl_index * cl_index) * inheritance_path -> Pp.t) -> unit
(**/**)
(** {6 This is for printing purpose } *)
@@ -113,3 +113,5 @@ val coercions : unit -> coe_info_typ list
(** [hide_coercion] returns the number of params to skip if the coercion must
be hidden, [None] otherwise; it raises [Not_found] if not a coercion *)
val hide_coercion : coe_typ -> int option
+
+val is_coercion_in_scope : GlobRef.t -> bool
diff --git a/pretyping/coercion.ml b/pretyping/coercion.ml
index 5e3821edf1..e15c00f7dc 100644
--- a/pretyping/coercion.ml
+++ b/pretyping/coercion.ml
@@ -363,12 +363,20 @@ let saturate_evd env evd =
Typeclasses.resolve_typeclasses
~filter:Typeclasses.no_goals ~split:true ~fail:false env evd
+let warn_coercion_not_in_scope =
+ CWarnings.create ~name:"coercion-not-in-scope" ~category:"deprecated"
+ Pp.(fun r -> str "Coercion used but not in scope: " ++
+ Nametab.pr_global_env Id.Set.empty r ++ str ". If you want to use "
+ ++ str "this coercion, please Import the module that contains it.")
+
(* Apply coercion path from p to hj; raise NoCoercion if not applicable *)
let apply_coercion env sigma p hj typ_cl =
try
let j,t,evd =
List.fold_left
(fun (ja,typ_cl,sigma) i ->
+ if not (is_coercion_in_scope i.coe_value) then
+ warn_coercion_not_in_scope i.coe_value;
let isid = i.coe_is_identity in
let isproj = i.coe_is_projection in
let sigma, c = new_global sigma i.coe_value in
@@ -386,7 +394,6 @@ let apply_coercion env sigma p hj typ_cl =
(hj,typ_cl,sigma) p
in evd, j
with NoCoercion as e -> raise e
- | e when CErrors.noncritical e -> anomaly (Pp.str "apply_coercion.")
(* Try to coerce to a funclass; raise NoCoercion if not possible *)
let inh_app_fun_core env evd j =
diff --git a/pretyping/inferCumulativity.ml b/pretyping/inferCumulativity.ml
index eb283a0220..be79b8b07d 100644
--- a/pretyping/inferCumulativity.ml
+++ b/pretyping/inferCumulativity.ml
@@ -99,7 +99,7 @@ let rec infer_fterm cv_pb infos variances hd stk =
| FEvar ((_,args),e) ->
let variances = infer_stack infos variances stk in
infer_vect infos variances (Array.map (mk_clos e) args)
- | FRel _ -> variances
+ | FRel _ -> infer_stack infos variances stk
| FFlex fl ->
let variances = infer_table_key infos variances fl in
infer_stack infos variances stk
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index 1810cc6588..9ed985195f 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -902,28 +902,28 @@ let inspect env sigma depth =
open Classops
-let print_coercion_value env sigma v = Printer.pr_global v.coe_value
+let print_coercion_value v = Printer.pr_global v.coe_value
let print_class i =
let cl,_ = class_info_from_index i in
pr_class cl
-let print_path env sigma ((i,j),p) =
+let print_path ((i,j),p) =
hov 2 (
- str"[" ++ hov 0 (prlist_with_sep pr_semicolon (print_coercion_value env sigma) p) ++
+ str"[" ++ hov 0 (prlist_with_sep pr_semicolon print_coercion_value p) ++
str"] : ") ++
print_class i ++ str" >-> " ++ print_class j
let _ = Classops.install_path_printer print_path
-let print_graph env sigma =
- prlist_with_sep fnl (print_path env sigma) (inheritance_graph())
+let print_graph () =
+ prlist_with_sep fnl print_path (inheritance_graph())
let print_classes () =
pr_sequence pr_class (classes())
-let print_coercions env sigma =
- pr_sequence (print_coercion_value env sigma) (coercions())
+let print_coercions () =
+ pr_sequence print_coercion_value (coercions())
let index_of_class cl =
try
@@ -932,7 +932,7 @@ let index_of_class cl =
user_err ~hdr:"index_of_class"
(pr_class cl ++ spc() ++ str "not a defined class.")
-let print_path_between env sigma cls clt =
+let print_path_between cls clt =
let i = index_of_class cls in
let j = index_of_class clt in
let p =
@@ -943,7 +943,7 @@ let print_path_between env sigma cls clt =
(str"No path between " ++ pr_class cls ++ str" and " ++ pr_class clt
++ str ".")
in
- print_path env sigma ((i,j),p)
+ print_path ((i,j),p)
let print_canonical_projections env sigma =
prlist_with_sep fnl
diff --git a/printing/prettyp.mli b/printing/prettyp.mli
index 1668bce297..58606db019 100644
--- a/printing/prettyp.mli
+++ b/printing/prettyp.mli
@@ -12,7 +12,6 @@ open Names
open Environ
open Reductionops
open Libnames
-open Evd
(** A Pretty-Printer for the Calculus of Inductive Constructions. *)
@@ -40,10 +39,10 @@ val print_about : env -> Evd.evar_map -> qualid Constrexpr.or_by_notation ->
val print_impargs : qualid Constrexpr.or_by_notation -> Pp.t
(** Pretty-printing functions for classes and coercions *)
-val print_graph : env -> evar_map -> Pp.t
+val print_graph : unit -> Pp.t
val print_classes : unit -> Pp.t
-val print_coercions : env -> Evd.evar_map -> Pp.t
-val print_path_between : env -> evar_map -> Classops.cl_typ -> Classops.cl_typ -> Pp.t
+val print_coercions : unit -> Pp.t
+val print_path_between : Classops.cl_typ -> Classops.cl_typ -> Pp.t
val print_canonical_projections : env -> Evd.evar_map -> Pp.t
(** Pretty-printing functions for type classes and instances *)
diff --git a/test-suite/Makefile b/test-suite/Makefile
index b8aac8b6f8..f5ec80bcfc 100644
--- a/test-suite/Makefile
+++ b/test-suite/Makefile
@@ -106,7 +106,8 @@ SUBSYSTEMS := $(VSUBSYSTEMS) misc bugs ide vio coqchk coqwc coq-makefile unit-te
PREREQUISITELOG = prerequisite/admit.v.log \
prerequisite/make_local.v.log prerequisite/make_notation.v.log \
- prerequisite/bind_univs.v.log
+ prerequisite/bind_univs.v.log prerequisite/module_bug8416.v.log \
+ prerequisite/module_bug7192.v.log
#######################################################################
# Phony targets
diff --git a/test-suite/bugs/closed/8288.v b/test-suite/bugs/closed/8288.v
new file mode 100644
index 0000000000..0350be9c06
--- /dev/null
+++ b/test-suite/bugs/closed/8288.v
@@ -0,0 +1,7 @@
+Set Universe Polymorphism.
+Set Printing Universes.
+
+Set Polymorphic Inductive Cumulativity.
+
+Inductive foo := C : (forall A : Type -> Type, A Type) -> foo.
+(* anomaly invalid subtyping relation *)
diff --git a/test-suite/output/PrintAssumptions.out b/test-suite/output/PrintAssumptions.out
index 34f44cd246..3f4d5ef58c 100644
--- a/test-suite/output/PrintAssumptions.out
+++ b/test-suite/output/PrintAssumptions.out
@@ -20,3 +20,5 @@ Axioms:
M.foo : False
Closed under the global context
Closed under the global context
+Closed under the global context
+Closed under the global context
diff --git a/test-suite/output/PrintAssumptions.v b/test-suite/output/PrintAssumptions.v
index ea1ab63786..3d4dfe603d 100644
--- a/test-suite/output/PrintAssumptions.v
+++ b/test-suite/output/PrintAssumptions.v
@@ -137,3 +137,13 @@ Module F (X : T).
End F.
End SUBMODULES.
+
+(* Testing a variant of #7192 across files *)
+(* This was missing in the original fix to #7192 *)
+Require Import module_bug7192.
+Print Assumptions M7192.D.f.
+
+(* Testing reporting assumptions from modules in files *)
+(* A regression introduced in the original fix to #7192 was missing implementations *)
+Require Import module_bug8416.
+Print Assumptions M8416.f.
diff --git a/test-suite/prerequisite/module_bug7192.v b/test-suite/prerequisite/module_bug7192.v
new file mode 100644
index 0000000000..82cfe560af
--- /dev/null
+++ b/test-suite/prerequisite/module_bug7192.v
@@ -0,0 +1,9 @@
+(* Variant of #7192 to be tested in a file requiring this file *)
+(* #7192 is about Print Assumptions not entering implementation of submodules *)
+
+Definition a := True.
+Module Type B. Axiom f : Prop. End B.
+Module Type C. Declare Module D : B. End C.
+Module M7192: C.
+ Module D <: B. Definition f := a. End D.
+End M7192.
diff --git a/test-suite/prerequisite/module_bug8416.v b/test-suite/prerequisite/module_bug8416.v
new file mode 100644
index 0000000000..70f43d132a
--- /dev/null
+++ b/test-suite/prerequisite/module_bug8416.v
@@ -0,0 +1,2 @@
+Module Type A. Axiom f : True. End A.
+Module M8416 : A. Definition f := I. End M8416.
diff --git a/theories/Numbers/Integer/Abstract/ZDivEucl.v b/theories/Numbers/Integer/Abstract/ZDivEucl.v
index ab17bb6e1a..a70ecd19d8 100644
--- a/theories/Numbers/Integer/Abstract/ZDivEucl.v
+++ b/theories/Numbers/Integer/Abstract/ZDivEucl.v
@@ -13,7 +13,7 @@ Require Import ZAxioms ZMulOrder ZSgnAbs NZDiv.
(** * Euclidean Division for integers, Euclid convention
We use here the "usual" formulation of the Euclid Theorem
- [forall a b, b<>0 -> exists b q, a = b*q+r /\ 0 < r < |b| ]
+ [forall a b, b<>0 -> exists r q, a = b*q+r /\ 0 <= r < |b| ]
The outcome of the modulo function is hence always positive.
This corresponds to convention "E" in the following paper:
diff --git a/theories/Program/Tactics.v b/theories/Program/Tactics.v
index bc83881849..edbae6534a 100644
--- a/theories/Program/Tactics.v
+++ b/theories/Program/Tactics.v
@@ -326,7 +326,7 @@ Ltac program_solve_wf :=
Create HintDb program discriminated.
-Ltac program_simpl := program_simplify ; try typeclasses eauto with program ; try program_solve_wf.
+Ltac program_simpl := program_simplify ; try typeclasses eauto 10 with program ; try program_solve_wf.
Obligation Tactic := program_simpl.
diff --git a/vernac/assumptions.ml b/vernac/assumptions.ml
index 765f962e99..e5d2382e46 100644
--- a/vernac/assumptions.ml
+++ b/vernac/assumptions.ml
@@ -70,7 +70,7 @@ let rec fields_of_functor f subs mp0 args = function
let rec lookup_module_in_impl mp =
match mp with
- | MPfile _ -> raise Not_found
+ | MPfile _ -> Global.lookup_module mp
| MPbound _ -> assert false
| MPdot (mp',lab') ->
if ModPath.equal mp' (Global.current_modpath ()) then
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index 84ce79d402..681dce3ca3 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -1809,13 +1809,13 @@ let vernac_print ~atts env sigma =
| PrintName (qid,udecl) ->
dump_global qid;
print_name env sigma qid udecl
- | PrintGraph -> Prettyp.print_graph env sigma
+ | PrintGraph -> Prettyp.print_graph ()
| PrintClasses -> Prettyp.print_classes()
| PrintTypeClasses -> Prettyp.print_typeclasses()
| PrintInstances c -> Prettyp.print_instances (smart_global c)
- | PrintCoercions -> Prettyp.print_coercions env sigma
+ | PrintCoercions -> Prettyp.print_coercions ()
| PrintCoercionPaths (cls,clt) ->
- Prettyp.print_path_between env sigma (cl_of_qualid cls) (cl_of_qualid clt)
+ Prettyp.print_path_between (cl_of_qualid cls) (cl_of_qualid clt)
| PrintCanonicalConversions -> Prettyp.print_canonical_projections env sigma
| PrintUniverses (b, dst) ->
let univ = Global.universes () in