Skip to content

Commit 8a4003d

Browse files
authored
Update the grammar to prevent an extension from having the name type (#3431)
1 parent c214fd9 commit 8a4003d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

specification/dart.sty

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
\def\THROW{\keyword{throw}}
6363
\def\TRUE{\keyword{true}}
6464
\def\TRY{\keyword{try}}
65+
\def\TYPE{\keyword{type}}
6566
\def\VAR{\keyword{var}}
6667
\def\VOID{\keyword{void}}
6768
\def\WHILE{\keyword{while}}

specification/dartLangSpec.tex

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
% version of the language which will actually be specified by the next stable
4242
% release of this document.
4343
%
44+
% Oct 2023
45+
% - Introduce the rule that an `extension` declaration cannot have the name
46+
% `type`. This is needed in order to disambiguate an `extension type`
47+
% named `on`.
48+
%
4449
% Aug 2023
4550
% - Correct text about built-in identifier error and turn it into commentary
4651
% (the normative text is in grammar rules using `typeIdentifier`), and
@@ -6083,8 +6088,8 @@ \section{Extensions}
60836088
and whether the invocation satisfies several other requirements.
60846089

60856090
\begin{grammar}
6086-
<extensionDeclaration> ::=
6087-
\gnewline{} \EXTENSION{} <typeIdentifier>? <typeParameters>? \ON{} <type>
6091+
<extensionDeclaration> ::= \gnewline{}
6092+
\EXTENSION{} <typeIdentifierNotType>? <typeParameters>? \ON{} <type>
60886093
\gnewline{} `\{' (<metadata> <classMemberDeclaration>)* `\}'
60896094
\end{grammar}
60906095

@@ -17154,10 +17159,13 @@ \subsection{Identifier Reference}
1715417159
\alt <BUILT\_IN\_IDENTIFIER>
1715517160
\alt <OTHER\_IDENTIFIER>
1715617161

17157-
<typeIdentifier> ::= <IDENTIFIER>
17158-
\alt <OTHER\_IDENTIFIER>
17162+
<typeIdentifierNotType> ::= <IDENTIFIER>
17163+
\alt <OTHER\_IDENTIFIER\_NOT\_TYPE>
1715917164
\alt \DYNAMIC{}
1716017165

17166+
<typeIdentifier> ::= <typeIdentifierNotType>
17167+
\alt \TYPE{}
17168+
1716117169
<qualifiedName> ::= <typeIdentifier> `.' <identifier>
1716217170
\alt <typeIdentifier> `.' <typeIdentifier> `.' <identifier>
1716317171

@@ -17168,10 +17176,13 @@ \subsection{Identifier Reference}
1716817176
\LIBRARY{} | \MIXIN{} | \OPERATOR{}
1716917177
\alt\hspace{-3mm} \PART{} | \REQUIRED{} | \SET{} | \STATIC{} | \TYPEDEF{}
1717017178

17171-
<OTHER\_IDENTIFIER> ::= \gnewline{}
17179+
<OTHER\_IDENTIFIER\_NOT\_TYPE> ::= \gnewline{}
1717217180
\ASYNC{} | \HIDE{} | \OF{} | \ON{} | \SHOW{} | \SYNC{} |
1717317181
\AWAIT{} | \YIELD{}
1717417182

17183+
<OTHER\_IDENTIFIER> ::= \gnewline{}
17184+
<OTHER\_IDENTIFIER\_NOT\_TYPE> | \TYPE{}
17185+
1717517186
<IDENTIFIER\_NO\_DOLLAR> ::= <IDENTIFIER\_START\_NO\_DOLLAR>
1717617187
\gnewline{} <IDENTIFIER\_PART\_NO\_DOLLAR>*
1717717188

0 commit comments

Comments
 (0)