aboutsummaryrefslogtreecommitdiff
path: root/test-suite/misc
diff options
context:
space:
mode:
authorGaëtan Gilbert2018-08-28 16:11:17 +0200
committerGaëtan Gilbert2018-09-13 15:05:57 +0200
commiteb4171d50d340e19e87a7a592b3d9c0d48654337 (patch)
tree11a45863e0c2493fd768730571cefe5c27a384e8 /test-suite/misc
parentec4aa4971f7789eeccec2f38f2bb7ec976f87ede (diff)
Add test for inconsistency from polymorphism capturing global univs
Diffstat (limited to 'test-suite/misc')
-rwxr-xr-xtest-suite/misc/poly-capture-global-univs.sh19
-rw-r--r--test-suite/misc/poly-capture-global-univs/.gitignore1
-rw-r--r--test-suite/misc/poly-capture-global-univs/_CoqProject9
-rw-r--r--test-suite/misc/poly-capture-global-univs/src/evil.ml49
-rw-r--r--test-suite/misc/poly-capture-global-univs/src/evilImpl.ml22
-rw-r--r--test-suite/misc/poly-capture-global-univs/src/evilImpl.mli2
-rw-r--r--test-suite/misc/poly-capture-global-univs/src/evil_plugin.mlpack2
-rw-r--r--test-suite/misc/poly-capture-global-univs/theories/evil.v13
8 files changed, 77 insertions, 0 deletions
diff --git a/test-suite/misc/poly-capture-global-univs.sh b/test-suite/misc/poly-capture-global-univs.sh
new file mode 100755
index 0000000000..e066ac039b
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -e
+
+export COQBIN=$BIN
+export PATH=$COQBIN:$PATH
+
+cd misc/poly-capture-global-univs/
+
+coq_makefile -f _CoqProject -o Makefile
+
+make clean
+
+make src/evil_plugin.cmxs
+
+if make; then
+ >&2 echo 'Should have failed!'
+ exit 1
+fi
diff --git a/test-suite/misc/poly-capture-global-univs/.gitignore b/test-suite/misc/poly-capture-global-univs/.gitignore
new file mode 100644
index 0000000000..f5a6d22b8e
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/.gitignore
@@ -0,0 +1 @@
+/Makefile*
diff --git a/test-suite/misc/poly-capture-global-univs/_CoqProject b/test-suite/misc/poly-capture-global-univs/_CoqProject
new file mode 100644
index 0000000000..70ec246062
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/_CoqProject
@@ -0,0 +1,9 @@
+-Q theories Evil
+-I src
+
+src/evil.ml4
+src/evilImpl.ml
+src/evilImpl.mli
+src/evil_plugin.mlpack
+theories/evil.v
+
diff --git a/test-suite/misc/poly-capture-global-univs/src/evil.ml4 b/test-suite/misc/poly-capture-global-univs/src/evil.ml4
new file mode 100644
index 0000000000..565e979aaa
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/src/evil.ml4
@@ -0,0 +1,9 @@
+
+open Stdarg
+open EvilImpl
+
+DECLARE PLUGIN "evil_plugin"
+
+VERNAC COMMAND FUNCTIONAL EXTEND VernacEvil CLASSIFIED AS SIDEFF
+| [ "Evil" ident(x) ident(y) ] -> [ fun ~atts ~st -> evil x y; st ]
+END
diff --git a/test-suite/misc/poly-capture-global-univs/src/evilImpl.ml b/test-suite/misc/poly-capture-global-univs/src/evilImpl.ml
new file mode 100644
index 0000000000..6d8ce7c5d7
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/src/evilImpl.ml
@@ -0,0 +1,22 @@
+open Names
+
+let evil t f =
+ let open Univ in
+ let open Entries in
+ let open Decl_kinds in
+ let open Constr in
+ let k = IsDefinition Definition in
+ let u = Level.var 0 in
+ let tu = mkType (Universe.make u) in
+ let te = Declare.definition_entry
+ ~univs:(Monomorphic_const_entry (ContextSet.singleton u)) tu
+ in
+ let tc = Declare.declare_constant t (DefinitionEntry te, k) in
+ let tc = mkConst tc in
+
+ let fe = Declare.definition_entry
+ ~univs:(Polymorphic_const_entry (UContext.make (Instance.of_array [|u|],Constraint.empty)))
+ ~types:(Term.mkArrow tc tu)
+ (mkLambda (Name.Name (Id.of_string "x"), tc, mkRel 1))
+ in
+ ignore (Declare.declare_constant f (DefinitionEntry fe, k))
diff --git a/test-suite/misc/poly-capture-global-univs/src/evilImpl.mli b/test-suite/misc/poly-capture-global-univs/src/evilImpl.mli
new file mode 100644
index 0000000000..97c7e3dadd
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/src/evilImpl.mli
@@ -0,0 +1,2 @@
+
+val evil : Names.Id.t -> Names.Id.t -> unit
diff --git a/test-suite/misc/poly-capture-global-univs/src/evil_plugin.mlpack b/test-suite/misc/poly-capture-global-univs/src/evil_plugin.mlpack
new file mode 100644
index 0000000000..0093328a40
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/src/evil_plugin.mlpack
@@ -0,0 +1,2 @@
+EvilImpl
+Evil
diff --git a/test-suite/misc/poly-capture-global-univs/theories/evil.v b/test-suite/misc/poly-capture-global-univs/theories/evil.v
new file mode 100644
index 0000000000..7fd98c2773
--- /dev/null
+++ b/test-suite/misc/poly-capture-global-univs/theories/evil.v
@@ -0,0 +1,13 @@
+
+Declare ML Module "evil_plugin".
+
+Evil T f. (* <- if this doesn't fail then the rest goes through *)
+
+Definition g : Type -> Set := f.
+
+Require Import Hurkens.
+
+Lemma absurd : False.
+Proof.
+ exact (TypeNeqSmallType.paradox (g Type) eq_refl).
+Qed.