From 8a4003d2d773e324d1a2ac7c9bbb553260f5cd5b Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Tue, 31 Oct 2023 14:29:01 +0100 Subject: [PATCH] Update the grammar to prevent an extension from having the name `type` (#3431) --- specification/dart.sty | 1 + specification/dartLangSpec.tex | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/specification/dart.sty b/specification/dart.sty index f7ff41474a..6c856874b5 100644 --- a/specification/dart.sty +++ b/specification/dart.sty @@ -62,6 +62,7 @@ \def\THROW{\keyword{throw}} \def\TRUE{\keyword{true}} \def\TRY{\keyword{try}} +\def\TYPE{\keyword{type}} \def\VAR{\keyword{var}} \def\VOID{\keyword{void}} \def\WHILE{\keyword{while}} diff --git a/specification/dartLangSpec.tex b/specification/dartLangSpec.tex index e6939e59f6..5c50dc51f0 100644 --- a/specification/dartLangSpec.tex +++ b/specification/dartLangSpec.tex @@ -41,6 +41,11 @@ % version of the language which will actually be specified by the next stable % release of this document. % +% Oct 2023 +% - Introduce the rule that an `extension` declaration cannot have the name +% `type`. This is needed in order to disambiguate an `extension type` +% named `on`. +% % Aug 2023 % - Correct text about built-in identifier error and turn it into commentary % (the normative text is in grammar rules using `typeIdentifier`), and @@ -6083,8 +6088,8 @@ \section{Extensions} and whether the invocation satisfies several other requirements. \begin{grammar} - ::= - \gnewline{} \EXTENSION{} ? ? \ON{} + ::= \gnewline{} + \EXTENSION{} ? ? \ON{} \gnewline{} `\{' ( )* `\}' \end{grammar} @@ -17154,10 +17159,13 @@ \subsection{Identifier Reference} \alt \alt - ::= - \alt + ::= + \alt \alt \DYNAMIC{} + ::= + \alt \TYPE{} + ::= `.' \alt `.' `.' @@ -17168,10 +17176,13 @@ \subsection{Identifier Reference} \LIBRARY{} | \MIXIN{} | \OPERATOR{} \alt\hspace{-3mm} \PART{} | \REQUIRED{} | \SET{} | \STATIC{} | \TYPEDEF{} - ::= \gnewline{} + ::= \gnewline{} \ASYNC{} | \HIDE{} | \OF{} | \ON{} | \SHOW{} | \SYNC{} | \AWAIT{} | \YIELD{} + ::= \gnewline{} + | \TYPE{} + ::= \gnewline{} *