aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Spiwack2014-09-03 16:32:12 +0200
committerArnaud Spiwack2014-09-04 10:25:55 +0200
commit706a4f3974c2f586ecb5d695e04e7b4f1b2e3d57 (patch)
tree8087b70459d3154a7f84d7f421ddae87160fc5fb
parenta93dbac35ed828286b0af9e5c6597081ed24a553 (diff)
Type definitions [Variant] and [Record] really don't accept the wrong kind of definition.
- [Variant] will accept variant definitions but no record definition - [Record] will accept record definitions but no variant definition
-rw-r--r--toplevel/vernacentries.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml
index 9cb88f5414..a5803a24d2 100644
--- a/toplevel/vernacentries.ml
+++ b/toplevel/vernacentries.ml
@@ -536,6 +536,10 @@ let vernac_inductive poly lo finite infer indl =
| _ -> () (* dumping is done by vernac_record (called below) *) )
indl;
match indl with
+ | [ ( _ , _ , _ ,Record, Constructors _ ),_ ] ->
+ Errors.error "The Record keyword cannot be used to define a variant type. Use Variant instead."
+ | [ (_ , _ , _ ,Variant, RecordDecl _),_ ] ->
+ Errors.error "The Variant keyword cannot be used to define a record type. Use Record instead."
| [ ( id , bl , c , b, RecordDecl (oc,fs) ), [] ] ->
vernac_record (match b with Class true -> Class false | _ -> b)
poly finite infer id bl c oc fs