aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2014-06-17 13:16:42 +0200
committerHugo Herbelin2014-06-17 16:06:41 +0200
commit1894f56849f01dbaf7c1fafed5c9b4f26ff6d2e5 (patch)
treea6ae8bccb04d556ec8682aa7d7d70c38a6c80c3e
parentd4a0f7af3b55792c548fae6e47eeef0925ee6e23 (diff)
Fixing #3282 (two bugs in the presence of let-in's in "fix").
-rw-r--r--interp/constrintern.ml2
-rw-r--r--pretyping/pretyping.ml2
-rw-r--r--test-suite/bugs/closed/3282.v7
3 files changed, 9 insertions, 2 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml
index 93feb8b460..dc1db3c2b9 100644
--- a/interp/constrintern.ml
+++ b/interp/constrintern.ml
@@ -1363,7 +1363,7 @@ let internalize globalenv env allow_patvar lvar c =
let (env',rbefore) =
List.fold_left intern_local_binder (env,[]) before in
let ro = f (intern env') in
- let n' = Option.map (fun _ -> List.length rbefore) n in
+ let n' = Option.map (fun _ -> List.length (List.filter (fun (_,(_,_,b,_)) -> (* remove let-ins *) b = None) rbefore)) n in
n', ro, List.fold_left intern_local_binder (env',rbefore) after
in
let n, ro, (env',rbl) =
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index 91b851d12f..6f8b407ae9 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -404,7 +404,7 @@ let rec pretype resolve_tc (tycon : type_constraint) env evdref lvar t =
type_bl (push_rel dcl env) (add_rel_decl dcl ctxt) bl
| (na,bk,Some bd,ty)::bl ->
let ty' = pretype_type empty_valcon env evdref lvar ty in
- let bd' = pretype (mk_tycon ty'.utj_val) env evdref lvar ty in
+ let bd' = pretype (mk_tycon ty'.utj_val) env evdref lvar bd in
let dcl = (na,Some bd'.uj_val,ty'.utj_val) in
type_bl (push_rel dcl env) (add_rel_decl dcl ctxt) bl in
let ctxtv = Array.map (type_bl env empty_rel_context) bl in
diff --git a/test-suite/bugs/closed/3282.v b/test-suite/bugs/closed/3282.v
new file mode 100644
index 0000000000..ce7cab1cba
--- /dev/null
+++ b/test-suite/bugs/closed/3282.v
@@ -0,0 +1,7 @@
+(* Check let-ins in fix and Fixpoint *)
+
+Definition foo := fix f (m : nat) (o := true) (n : nat) {struct n} :=
+ match n with 0 => 0 | S n' => f 0 n' end.
+
+Fixpoint f (m : nat) (o := true) (n : nat) {struct n} :=
+ match n with 0 => 0 | S n' => f 0 n' end.