aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-08-28 01:07:07 +0200
committerPierre-Marie Pédrot2017-08-29 17:20:40 +0200
commit5fb53743cc14047b4be12c188c21c6f679bdbd8f (patch)
treef81997dfa6d64829e204335c1e63d8a47f29fecd
parenta980d38681f7ab9bfd8a180f2252ce573e3ff211 (diff)
Fix BZ#5697: Congruence does not work with primitive projections.
The code generating the projection was unconditionally generating pattern-matchings, although this is incorrect for primitive records.
-rw-r--r--tactics/equality.ml3
-rw-r--r--test-suite/bugs/closed/5697.v10
2 files changed, 12 insertions, 1 deletions
diff --git a/tactics/equality.ml b/tactics/equality.ml
index ad6abfa1f6..3ea9538f38 100644
--- a/tactics/equality.ml
+++ b/tactics/equality.ml
@@ -922,7 +922,8 @@ let build_selector env sigma dirn c ind special default =
let brl =
List.map build_branch(List.interval 1 (Array.length mip.mind_consnames)) in
let ci = make_case_info env ind RegularStyle in
- mkCase (ci, p, c, Array.of_list brl)
+ let ans = Inductiveops.make_case_or_project env sigma indf ci p c (Array.of_list brl) in
+ ans
let build_coq_False () = pf_constr_of_global (build_coq_False ())
let build_coq_True () = pf_constr_of_global (build_coq_True ())
diff --git a/test-suite/bugs/closed/5697.v b/test-suite/bugs/closed/5697.v
new file mode 100644
index 0000000000..a17229aaff
--- /dev/null
+++ b/test-suite/bugs/closed/5697.v
@@ -0,0 +1,10 @@
+Set Primitive Projections.
+
+Record foo : Type := Foo { foo_car: nat }.
+
+Goal forall x y : nat, x <> y -> Foo x <> Foo y.
+Proof.
+intros.
+intros H'.
+congruence.
+Qed.