aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Sozeau2014-09-04 00:40:12 +0200
committerMatthieu Sozeau2014-09-04 01:13:33 +0200
commitc907f31fd8f4b12bf2d7df2078603dbe804475a2 (patch)
treeb75855bdeb6a2beff49eb95c2ba7c877696fe61a
parentcd10b70637dea3cbba5785d163bc567a32a031a8 (diff)
Add test-suite file for Case derivation on primitive records.
-rw-r--r--pretyping/indrec.ml6
-rw-r--r--test-suite/success/letproj.v9
2 files changed, 13 insertions, 2 deletions
diff --git a/pretyping/indrec.ml b/pretyping/indrec.ml
index 547268ef08..54f76fa33f 100644
--- a/pretyping/indrec.ml
+++ b/pretyping/indrec.ml
@@ -105,8 +105,10 @@ let mis_make_case_com dep env sigma (ind, u as pind) (mib,mip as specif) kind =
Termops.rel_vect ndepar k)
| Some ps ->
let term = mkApp (mkRel 2, Array.map (fun p -> mkProj (p, mkRel 1)) ps) in
- let ty = mkApp (mkRel 3, [| mkRel 1 |]) in
- mkCast (term, DEFAULTcast, ty)
+ if dep then
+ let ty = mkApp (mkRel 3, [| mkRel 1 |]) in
+ mkCast (term, DEFAULTcast, ty)
+ else term
in
it_mkLambda_or_LetIn_name env' obj deparsign
else
diff --git a/test-suite/success/letproj.v b/test-suite/success/letproj.v
new file mode 100644
index 0000000000..a183be6223
--- /dev/null
+++ b/test-suite/success/letproj.v
@@ -0,0 +1,9 @@
+Set Primitive Projections.
+Set Record Elimination Schemes.
+Record Foo (A : Type) := { bar : A -> A; baz : A }.
+
+Definition test (A : Type) (f : Foo A) :=
+ let (x, y) := f in x.
+
+Scheme foo_case := Case for Foo Sort Type.
+