Skip to content

Commit 537119a

Browse files
authored
Tiny fix: A top-level declaration pair (same basename) must be a getter and a setter (#1594)
Fix omission: A top-level declaration pair (same basename) must be a getter and a setter. Also disambiguate method/setter error rule in 'Class Member Conflicts' and fix typo in section Exports.
1 parent 7282583 commit 537119a

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

specification/dartLangSpec.tex

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
%
2727
% Significant changes to the specification.
2828
%
29-
% 2.13 (there was no 2.12)
29+
% 2.12 - 2.13 (there was no 2.11)
3030
% - Revert the CL where certain null safety features were removed (to enable
3131
% publishing a stable version of the specification).
32+
% - Add rule that a top-level pair of declarations with the same basename
33+
% is a compile-time error except when it is a getter/setter pair.
3234
%
3335
% 2.8 - 2.10
3436
% - Change several warnings to compile-time errors, matching the actual
@@ -4541,7 +4543,9 @@ \subsection{Class Member Conflicts}
45414543
declares a static member with basename $n$ and
45424544
the interface of $C$ has an instance member with basename $n$.
45434545
It is a compile-time error if the interface of $C$
4544-
has a method named $n$ and a setter with basename $n$.
4546+
has an instance method named $n$ and an instance setter with basename $n$.
4547+
It is a compile-time error if $C$ declares a static method named $n$
4548+
and a static setter with basename $n$.
45454549

45464550
\LMHash{}%
45474551
When \DefineSymbol{C} is a mixin or an extension,
@@ -18232,16 +18236,17 @@ \section{Libraries and Scripts}
1823218236
\LMHash{}%
1823318237
A library may optionally begin with a \Index{script tag}.
1823418238
Script tags are intended for use with scripts (\ref{scripts}).
18235-
A script tag can be used to identify the interpreter of the script to whatever computing environment the script is embedded in.
18239+
A script tag can be used to identify the interpreter of the script to
18240+
whatever computing environment the script is embedded in.
1823618241
The script tag must appear before any whitespace or comments.
1823718242
A script tag begins with \lit{\#!} and ends at the end of the line.
1823818243
Any characters that follow \lit{\#!} in the script tag are ignored by
1823918244
the Dart implementation.
1824018245

1824118246
\LMHash{}%
1824218247
Libraries are units of privacy.
18243-
A private declaration declared within a library $L$ can only be accessed by code within $L$.
18244-
Any attempt to access a private member declaration from outside $L$ will cause a method, getter or setter lookup failure.
18248+
A private declaration declared within a library $L$
18249+
can only be accessed by code within $L$.
1824518250

1824618251
\commentary{%
1824718252
Since top level privates are not imported,
@@ -18250,14 +18255,27 @@ \section{Libraries and Scripts}
1825018255

1825118256
\LMHash{}%
1825218257
The \Index{public namespace} of library $L$ is the namespace that maps
18253-
the simple name of each public top-level member declaration $m$ of $L$ to $m$.
18258+
the name of each public top-level member declaration $m$ of $L$ to $m$.
1825418259
The \Index{local namespace} of library $L$ is the namespace that maps
1825518260
the names introduced by each top-level declaration of $L$
1825618261
to the corresponding declaration.
1825718262
The \Index{library scope} of library $L$ is the outermost scope in $L$,
1825818263
and its namespace is the library namespace of $L$
1825918264
(\ref{theImportedNamespace}).
1826018265

18266+
\LMHash{}%
18267+
% A setter can not be paired with a function, class, etc.
18268+
It is a compile-time error if the local namespace of library $L$
18269+
has two declarations with the same basename,
18270+
except when they are a getter and a setter.
18271+
18272+
\commentary{%
18273+
Two distinct names $n_1$ and $n_2$ can only have the same basename
18274+
when they are of the form \id{} and \code{\id=},
18275+
so this kind of conflict \emph{always} involves a setter.
18276+
But the other declaration could be a function, a class, etc.%
18277+
}
18278+
1826118279

1826218280
\subsection{Imports}
1826318281
\LMLabel{imports}
@@ -18795,7 +18813,7 @@ \subsection{Exports}
1879518813
Let \NamespaceName{\metavar{merged}} be the result of applying
1879618814
conflict merging
1879718815
(\ref{conflictMergingOfNamespaces})
18798-
to \List{\metavar{NS}}{\metavar{one},1}{\metavar{one},m}.
18816+
to \List{\metavar{NS}}{\metavar{exported},1}{\metavar{exported},m}.
1879918817
A compile-time error occurs if any name in
1880018818
\NamespaceName{\metavar{merged}}
1880118819
is conflicted

0 commit comments

Comments
 (0)