aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2018-02-13 12:19:47 +0100
committerHugo Herbelin2018-02-13 12:22:34 +0100
commit50c948480647af3c5aaea5f80fa9f3341471f2b0 (patch)
tree26f18a3c560197dede4932f02b4ac4d8a4acc701
parentd2fb531761e1f4fa02d0c7e7b5b51febe48e357e (diff)
Fixing an anomaly in the presence of "let-in" in the type of a record.
Was raised by Jason on Gitter.
-rw-r--r--test-suite/success/Inductive.v6
-rw-r--r--vernac/record.ml2
2 files changed, 7 insertions, 1 deletions
diff --git a/test-suite/success/Inductive.v b/test-suite/success/Inductive.v
index 893d75b77f..5b1482fd58 100644
--- a/test-suite/success/Inductive.v
+++ b/test-suite/success/Inductive.v
@@ -200,3 +200,9 @@ Module NonRecLetIn.
(fun n b c => f_equal (Rec n) eq_refl) 0 (Rec 0 (Base 1)).
End NonRecLetIn.
+
+(* Test treatment of let-in in the definition of Records *)
+(* Should fail with "Sort expected" *)
+
+Fail Inductive foo (T : Type) : let T := Type in T :=
+ { r : forall x : T, x = x }.
diff --git a/vernac/record.ml b/vernac/record.ml
index d9af5378f4..95bcaf6dc3 100644
--- a/vernac/record.ml
+++ b/vernac/record.ml
@@ -121,7 +121,7 @@ let typecheck_params_and_fields finite def id poly pl t ps nots fs =
match t with
| { CAst.v = CSort (Misctypes.GType []) } -> true | _ -> false in
let sigma, s = interp_type_evars env sigma ~impls:empty_internalization_env t in
- let sred = Reductionops.whd_all env sigma s in
+ let sred = Reductionops.whd_allnolet env sigma s in
(match EConstr.kind sigma sred with
| Sort s' ->
let s' = EConstr.ESorts.kind sigma s' in