From 906b063b798e6c0787fd8f514b9d7f1f8eef9cf8 Mon Sep 17 00:00:00 2001 From: letouzey Date: Mon, 18 Mar 2013 18:55:24 +0000 Subject: Fix for bug #3004 (thanks Hugo!) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16317 85f007b7-540e-0410-9357-904b9bb8a0f7 --- pretyping/evarsolve.ml | 5 ++++- test-suite/bugs/closed/shouldsucceed/3004.v | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test-suite/bugs/closed/shouldsucceed/3004.v 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. -- cgit v1.2.3