aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorletouzey2013-03-18 18:55:24 +0000
committerletouzey2013-03-18 18:55:24 +0000
commit906b063b798e6c0787fd8f514b9d7f1f8eef9cf8 (patch)
treef59273e5505a9ad8fde210b1e3b4178257480f1c
parenta19029dee21f77391d99b780582f82bb3ba3b831 (diff)
Fix for bug #3004 (thanks Hugo!)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16317 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--pretyping/evarsolve.ml5
-rw-r--r--test-suite/bugs/closed/shouldsucceed/3004.v7
2 files changed, 11 insertions, 1 deletions
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml
index 83462d4c45..a2eebcc242 100644
--- a/pretyping/evarsolve.ml
+++ b/pretyping/evarsolve.ml
@@ -948,7 +948,10 @@ let rec is_constrainable_in k (ev,(fv_rels,fv_ids) as g) t =
let f,args = decompose_app_vect t in
match kind_of_term f with
| Construct (ind,_) ->
- let params,_ = Array.chop (Inductiveops.inductive_nparams ind) args in
+ let n = Inductiveops.inductive_nparams ind in
+ if n > Array.length args then true (* We don't try to be more clever *)
+ else
+ let params = fst (Array.chop n args) in
Array.for_all (is_constrainable_in k g) params
| Ind _ -> Array.for_all (is_constrainable_in k g) args
| Prod (_,t1,t2) -> is_constrainable_in k g t1 && is_constrainable_in k g t2
diff --git a/test-suite/bugs/closed/shouldsucceed/3004.v b/test-suite/bugs/closed/shouldsucceed/3004.v
new file mode 100644
index 0000000000..896b1958b0
--- /dev/null
+++ b/test-suite/bugs/closed/shouldsucceed/3004.v
@@ -0,0 +1,7 @@
+Set Implicit Arguments.
+Unset Strict Implicit.
+Parameter (M : nat -> Type).
+Parameter (mp : forall (T1 T2 : Type) (f : T1 -> T2), list T1 -> list T2).
+
+Definition foo (s : list {n : nat & M n}) :=
+ let exT := existT in mp (fun x => projT1 x) s.