aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Sozeau2015-11-03 17:25:49 -0500
committerMatthieu Sozeau2015-11-04 11:25:50 -0500
commitb30ca8ac9e0225e6505fea0004ea37e7649c9cb6 (patch)
tree0a16bf29d60f9b27530b9c5fa2e1c58aa210353a
parentf4ff8f4f8b0bd2c721e4984faf7360d6fab93b05 (diff)
Fix bug in proofs/logic.ml type_of_global_reference_knowing_conclusion
is buggy in general.
-rw-r--r--proofs/logic.ml6
-rw-r--r--tactics/tactics.ml2
-rw-r--r--test-suite/bugs/closed/4394.v14
3 files changed, 15 insertions, 7 deletions
diff --git a/proofs/logic.ml b/proofs/logic.ml
index 5c48995fc7..3273c95728 100644
--- a/proofs/logic.ml
+++ b/proofs/logic.ml
@@ -356,9 +356,11 @@ let rec mk_refgoals sigma goal goalacc conclty trm =
| App (f,l) ->
let (acc',hdty,sigma,applicand) =
if is_template_polymorphic env f then
- let sigma, ty =
+ let ty =
(* Template sort-polymorphism of definition and inductive types *)
- type_of_global_reference_knowing_conclusion env sigma f conclty
+ let firstmeta = Array.findi (fun i x -> occur_meta x) l in
+ let args, _ = Option.cata (fun i -> CArray.chop i l) (l, [||]) firstmeta in
+ type_of_global_reference_knowing_parameters env sigma f args
in
goalacc, ty, sigma, f
else
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 7756553e2d..2a46efd8ef 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -3329,7 +3329,7 @@ let abstract_args gl generalize_vars dep id defined f args =
if defined then Some c', typ_of ctxenv !sigma c'
else None, c'
in
- let term = make_abstract_generalize gl id concl dep ctx body c' eqs args refls in
+ let term = make_abstract_generalize {gl with sigma = !sigma} id concl dep ctx body c' eqs args refls in
Some (term, !sigma, dep, succ (List.length ctx), vars)
else None
diff --git a/test-suite/bugs/closed/4394.v b/test-suite/bugs/closed/4394.v
index 751f1e697d..60c9354597 100644
--- a/test-suite/bugs/closed/4394.v
+++ b/test-suite/bugs/closed/4394.v
@@ -1,13 +1,19 @@
(* -*- coq-prog-args: ("-emacs" "-compat" "8.4") -*- *)
+
Require Import Equality List.
-Unset Strict Universe Declaration.
-Inductive Foo I A := foo (B : Type) : A -> I B -> Foo I A.
+Inductive Foo (I : Type -> Type) (A : Type) : Type :=
+| foo (B : Type) : A -> I B -> Foo I A.
Definition Family := Type -> Type.
-Definition fooFamily family : Family := Foo family.
+Definition FooToo : Family -> Family := Foo.
+Definition optionize (I : Type -> Type) (A : Type) := option (I A).
+Definition bar (I : Type -> Type) (A : Type) : A -> option (I A) -> Foo (optionize I) A := foo (optionize I) A A.
+Record Rec (I : Type -> Type) := { rec : forall A : Type, A -> I A -> Foo I A }.
+Definition barRec : Rec (optionize id) := {| rec := bar id |}.
Inductive Empty {T} : T -> Prop := .
Theorem empty (family : Family) (a : fold_right prod unit (map (Foo family) nil)) (b : unit) :
Empty (a, b) -> False.
Proof.
intro e.
dependent induction e.
-Qed. \ No newline at end of file
+Qed.
+