aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2020-02-23 15:42:15 -0500
committerEmilio Jesus Gallego Arias2020-02-23 15:42:15 -0500
commitc4259da61f63ff6c2b088398a6f7fae31a2ebeb2 (patch)
tree3e638f56cb32dcd2f513848ebe1e0723b4ebd79e /doc
parent6354eb0cec6a59bfe23aa3b332b3b8c13259f555 (diff)
parent9e6637326483d1356376bf8bb2fcf2183d3f345b (diff)
Merge PR #11120: Refactoring code for application printing + fixing #11091 (inconsistencies in parsing/printing notations to partial applications)
Ack-by: Zimmi48 Reviewed-by: ejgallego Ack-by: jfehrle
Diffstat (limited to 'doc')
-rw-r--r--doc/changelog/03-notations/11120-master+refactoring-application-printing.rst17
-rw-r--r--doc/sphinx/user-extensions/syntax-extensions.rst27
2 files changed, 44 insertions, 0 deletions
diff --git a/doc/changelog/03-notations/11120-master+refactoring-application-printing.rst b/doc/changelog/03-notations/11120-master+refactoring-application-printing.rst
new file mode 100644
index 0000000000..d95f554766
--- /dev/null
+++ b/doc/changelog/03-notations/11120-master+refactoring-application-printing.rst
@@ -0,0 +1,17 @@
+- **Fixed:** Parsing and printing consistently handle inheritance of implicit
+ arguments in notations. With the exception of notations of
+ the form :n:`Notation @string := @@qualid` and :n:`Notation @ident := @@qualid` which
+ inhibit implicit arguments, all notations binding a partially
+ applied constant, as e.g. in :n:`Notation @string := (@qualid {+ @arg })`,
+ or :n:`Notation @string := (@@qualid {+ @arg })`, or
+ :n:`Notation @ident := (@qualid {+ @arg })`, or :n:`Notation @ident
+ := (@@qualid {+ @arg })`, inherit the remaining implicit arguments
+ (`#11120 <https://github.com/coq/coq/pull/11120>`_, by Hugo
+ Herbelin, fixing `#4690 <https://github.com/coq/coq/pull/4690>`_ and
+ `#11091 <https://github.com/coq/coq/pull/11091>`_).
+
+- **Changed:** Interpretation scopes are now always inherited in
+ notations binding a partially applied constant, including for
+ notations binding an expression of the form :n:`@@qualid`. The latter was
+ not the case beforehand
+ (part of `#11120 <https://github.com/coq/coq/pull/11120>`_).
diff --git a/doc/sphinx/user-extensions/syntax-extensions.rst b/doc/sphinx/user-extensions/syntax-extensions.rst
index 7c628e534b..8bfcab0f4e 100644
--- a/doc/sphinx/user-extensions/syntax-extensions.rst
+++ b/doc/sphinx/user-extensions/syntax-extensions.rst
@@ -417,6 +417,27 @@ identifiers or tokens starting with a single quote are dropped.
Locate "exists".
Locate "exists _ .. _ , _".
+Inheritance of the properties of arguments of constants bound to a notation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If the right-hand side of a notation is a partially applied constant,
+the notation inherits the implicit arguments (see
+:ref:`ImplicitArguments`) and interpretation scopes (see
+:ref:`Scopes`) of the constant. For instance:
+
+.. coqtop:: in reset
+
+ Record R := {dom : Type; op : forall {A}, A -> dom}.
+ Notation "# x" := (@op x) (at level 8).
+
+.. coqtop:: all
+
+ Check fun x:R => # x 3.
+
+As an exception, if the right-hand side is just of the form
+:n:`@@qualid`, this conventionally stops the inheritance of implicit
+arguments (but not of interpretation scopes).
+
Notations and binders
~~~~~~~~~~~~~~~~~~~~~
@@ -1415,6 +1436,12 @@ Abbreviations
denoted expression is performed at definition time. Type checking is
done only at the time of use of the abbreviation.
+ Like for notations, if the right-hand side of an abbreviation is a
+ partially applied constant, the abbreviation inherits the implicit
+ arguments and interpretation scopes of the constant. As an
+ exception, if the right-hand side is just of the form :n:`@@qualid`,
+ this conventionally stops the inheritance of implicit arguments.
+
.. _numeral-notations:
Numeral notations