diff options
author | Jason Gross <jgross@mit.edu> | 2016-06-08 17:33:12 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2016-06-09 10:00:58 -0400 |
commit | d8825650bd2b7855a92195c032a539aa3f09c9ef (patch) | |
tree | e979f7b12c056da00d831ae27dd01124225cdf5a /test-suite/bugs/closed/4684.v | |
parent | 87f9a317b020554abef358aec614dad1fdc0bd98 (diff) |
Unbreak singleton list-like notation (-compat 8.4)
With this commit, it is possible to write notations so that singleton
lists are usable in both 8.4 and 8.5pl1 -compat. Longer lists await the
ability to remove notations from the parser.
Diffstat (limited to 'test-suite/bugs/closed/4684.v')
-rw-r--r-- | test-suite/bugs/closed/4684.v | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test-suite/bugs/closed/4684.v b/test-suite/bugs/closed/4684.v new file mode 100644 index 000000000..9c0bed42c --- /dev/null +++ b/test-suite/bugs/closed/4684.v @@ -0,0 +1,32 @@ +(*Suppose a user wants to declare a new list-like notation with support for singletons in both 8.4 and 8.5. If they use*) +Require Import Coq.Lists.List. +Require Import Coq.Vectors.Vector. +Import ListNotations. +Import VectorNotations. +Set Implicit Arguments. +Inductive mylist T := mynil | mycons (_ : T) (_ : mylist T). +Arguments mynil {_}, _. + +Delimit Scope mylist_scope with mylist. +Bind Scope mylist_scope with mylist. +Delimit Scope vector_scope with vector. + +Notation " [ ] " := mynil (format "[ ]") : mylist_scope. +Notation " [ x ] " := (mycons x mynil) : mylist_scope. +Notation " [ x ; y ; .. ; z ] " := (mycons x (mycons y .. (mycons z mynil) ..)) : mylist_scope. + +Check [ ]%mylist : mylist _. +Check [ ]%list : list _. +Check []%vector : Vector.t _ _. +Check [ _ ]%mylist : mylist _. +Check [ _ ]%list : list _. +Check [ _ ]%vector : Vector.t _ _. +Check [ _ ; _ ]%list : list _. +Check [ _ ; _ ]%vector : Vector.t _ _. +Check [ _ ; _ ]%mylist : mylist _. +Check [ _ ; _ ; _ ]%list : list _. +Check [ _ ; _ ; _ ]%vector : Vector.t _ _. +Check [ _ ; _ ; _ ]%mylist : mylist _. +Check [ _ ; _ ; _ ; _ ]%list : list _. +Check [ _ ; _ ; _ ; _ ]%vector : Vector.t _ _. +Check [ _ ; _ ; _ ; _ ]%mylist : mylist _. |