From 0c4eea2553d5b3b70d0b5baaf92781a544de83bd Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Thu, 23 Nov 2017 13:30:36 +0100 Subject: Change default for notations with variables bound to both terms and binders. For compatibility, the default is to parse as ident and not as pattern. --- test-suite/output/Notations3.out | 6 ++++++ test-suite/output/Notations3.v | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'test-suite/output') diff --git a/test-suite/output/Notations3.out b/test-suite/output/Notations3.out index 3fd4c1c31..436e97e9f 100644 --- a/test-suite/output/Notations3.out +++ b/test-suite/output/Notations3.out @@ -219,3 +219,9 @@ fun p : nat => if p is S n then n else 0 : nat -> nat fun p : comparison => if p is Lt then 1 else 0 : comparison -> nat +fun S : nat => [S | S + S] + : nat -> nat * (nat -> nat) +fun N : nat => [N | N + 0] + : nat -> nat * (nat -> nat) +fun S : nat => [[S | S + S]] + : nat -> nat * (nat -> nat) diff --git a/test-suite/output/Notations3.v b/test-suite/output/Notations3.v index 9ea218481..df3d86793 100644 --- a/test-suite/output/Notations3.v +++ b/test-suite/output/Notations3.v @@ -389,3 +389,15 @@ Notation "'if' c 'is' p 'then' u 'else' v" := (at level 200, p pattern at level 100). Check fun p => if p is S n then n else 0. Check fun p => if p is Lt then 1 else 0. + +(* Check that mixed binders and terms defaults to ident and not pattern *) +Module E. + (* First without an indirection *) +Notation "[ n | t ]" := (n, (fun n : nat => t)). +Check fun S : nat => [ S | S+S ]. +Check fun N : nat => (N, (fun n => n+0)). (* another test in passing *) + (* Then with an indirection *) +Notation "[[ n | p | t ]]" := (n, (fun p : nat => t)). +Notation "[[ n | t ]]" := [[ n | n | t ]]. +Check fun S : nat => [[ S | S+S ]]. +End E. -- cgit v1.2.3