aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorMaxime Dénès2018-09-13 17:15:50 +0200
committerMaxime Dénès2018-09-13 17:15:50 +0200
commit9281bb33f2b9aa5d762f8b5b8b0159984b696efb (patch)
treef3d728fd0428376c36d3012df583164b2ab47330 /test-suite
parentd3fee162c5e2f39b313cde1e1fa738480d960163 (diff)
parent5cf8ec5afe59a420130a6b0828e48b6d87bb1e3c (diff)
Merge PR #8303: Better controls for template polymorphism
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/success/Template.v48
1 files changed, 48 insertions, 0 deletions
diff --git a/test-suite/success/Template.v b/test-suite/success/Template.v
new file mode 100644
index 0000000000..1c6e2d81d8
--- /dev/null
+++ b/test-suite/success/Template.v
@@ -0,0 +1,48 @@
+Set Printing Universes.
+
+Module AutoYes.
+ Inductive Box (A:Type) : Type := box : A -> Box A.
+
+ About Box.
+
+ (* This checks that Box is template poly, see module No for how it fails *)
+ Universe i j. Constraint i < j.
+ Definition j_lebox (A:Type@{j}) := Box A.
+ Definition box_lti A := Box A : Type@{i}.
+
+End AutoYes.
+
+Module AutoNo.
+ Unset Auto Template Polymorphism.
+ Inductive Box (A:Type) : Type := box : A -> Box A.
+
+ About Box.
+
+ Universe i j. Constraint i < j.
+ Definition j_lebox (A:Type@{j}) := Box A.
+ Fail Definition box_lti A := Box A : Type@{i}.
+
+End AutoNo.
+
+Module Yes.
+ #[template]
+ Inductive Box@{i} (A:Type@{i}) : Type@{i} := box : A -> Box A.
+
+ About Box.
+
+ Universe i j. Constraint i < j.
+ Definition j_lebox (A:Type@{j}) := Box A.
+ Definition box_lti A := Box A : Type@{i}.
+
+End Yes.
+
+Module No.
+ #[notemplate]
+ Inductive Box (A:Type) : Type := box : A -> Box A.
+
+ About Box.
+
+ Universe i j. Constraint i < j.
+ Definition j_lebox (A:Type@{j}) := Box A.
+ Fail Definition box_lti A := Box A : Type@{i}.
+End No.