Skip to content

Commit 2ac4f81

Browse files
authored
Change <extensionDeclaration> to use <typeIdentifier> (#2923)
Change `<extensionDeclaration>` to use `<typeIdentifier>`. Remove compile-time error which is now covered by the syntax. Move `?` on `typeNotVoidNotFunction` (avoiding useless permission to have `class B extends A? ..` where `A?` is then a compile-time error anyway.
1 parent bb001dc commit 2ac4f81

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

specification/dartLangSpec.tex

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
% Mar 2023
5959
% - Clarify how line breaks are handled in a multi-line string literal. Rename
6060
% the lexical token NEWLINE to LINE\_BREAK (clarifying that it is not `\n`).
61+
% - Clean up grammar rules (avoid `T?` as a superclass/etc., which is an
62+
% error anyway; change extension names to `typeIdentifier`, avoiding
63+
% built-in identifiers).
6164
%
6265
% Feb 2023
6366
% - Change the specification of constant expressions of the form `e1 == e2`
@@ -6064,7 +6067,7 @@ \section{Extensions}
60646067

60656068
\begin{grammar}
60666069
<extensionDeclaration> ::=
6067-
\gnewline{} \EXTENSION{} <identifier>? <typeParameters>? \ON{} <type>
6070+
\gnewline{} \EXTENSION{} <typeIdentifier>? <typeParameters>? \ON{} <type>
60686071
\gnewline{} `\{' (<metadata> <classMemberDeclaration>)* `\}'
60696072
\end{grammar}
60706073

@@ -6167,8 +6170,6 @@ \section{Extensions}
61676170
e.g., in order to access static members of the extension,
61686171
or in order to resolve an invocation explicitly%
61696172
}).
6170-
A compile-time error occurs if the declared name of an extension
6171-
is a built-in identifier.
61726173

61736174
\LMHash{}%
61746175
An extension declaration introduces two scopes:
@@ -20690,11 +20691,6 @@ \subsection{Static Types}
2069020691
it denotes an \synt{IDENTIFIER} which is not a \synt{BUILT\_IN\_IDENTIFIER}
2069120692
(\ref{identifierReference}).%
2069220693
}
20693-
%% TODO(eernst): The following non-terminals are currently unused (they will
20694-
%% be used when we transfer more grammar rules from Dart.g): <typeNotVoid>
20695-
%% and <typeNotVoidNotFunctionList>. They are used in the syntax for
20696-
%% \EXTENDS, \WITH, \IMPLEMENTS{} syntax and for mixin applications
20697-
%% in Dart.g, and it seems likely that we will use them here as well.
2069820694

2069920695
\commentary{%
2070020696
Non-terminals with names of the form \synt{\ldots{}NotFunction}
@@ -20710,13 +20706,13 @@ \subsection{Static Types}
2071020706
\alt <typeNotFunction>
2071120707

2071220708
<typeNotVoid> ::= <functionType> `?'?
20713-
\alt <typeNotVoidNotFunction>
20709+
\alt <typeNotVoidNotFunction> `?'?
2071420710

2071520711
<typeNotFunction> ::= \VOID{}
20716-
\alt <typeNotVoidNotFunction>
20712+
\alt <typeNotVoidNotFunction> `?'?
2071720713

20718-
<typeNotVoidNotFunction> ::= <typeName> <typeArguments>? `?'?
20719-
\alt \FUNCTION{} `?'?
20714+
<typeNotVoidNotFunction> ::= <typeName> <typeArguments>?
20715+
\alt \FUNCTION{}
2072020716

2072120717
<typeName> ::= <typeIdentifier> (`.' <typeIdentifier>)?
2072220718

0 commit comments

Comments
 (0)