@@ -20924,7 +20924,8 @@ \section{Types}
20924
20924
\LMLabel{types}
20925
20925
20926
20926
\LMHash{}%
20927
- Dart supports static typing based on interface types.
20927
+ Dart supports static typing based on interface types
20928
+ (\ref{interfaceTypes}).
20928
20929
20929
20930
\rationale{%
20930
20931
The type system is sound in the sense that
@@ -21731,8 +21732,7 @@ \subsection{Subtypes}
21731
21732
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
21732
21733
% ------------------------------------------------ Right Object
21733
21734
\RuleRaw{\SrnRightObjectFour}{%
21734
- \mbox{$S$ is an interface type,}\\
21735
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
21735
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
21736
21736
% ------------------------------------------------ Left Null 2
21737
21737
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
21738
21738
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22107,8 +22107,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22107
22107
\Item{\SrnBottom}{Bottom}
22108
22108
\code{Never} is a subtype of every type.
22109
22109
\Item{\SrnRightObjectFour}{Right Object}
22110
- Interface types, function types, and \FUNCTION{}
22111
- are subtypes of \code{Object}.
22110
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22112
22111
\Item{\SrnNullOne}{Null Nullable}
22113
22112
\code{Null} is a subtype of every type of the form \code{$T$?}.
22114
22113
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22296,7 +22295,7 @@ \subsection{Type Nullability}
22296
22295
\item \code{Never}.
22297
22296
\item Any function type.
22298
22297
\item The type \FUNCTION.
22299
- \item Any interface type except \code{Null} .
22298
+ \item Any interface type.
22300
22299
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22301
22300
\item Any type variable $X$ whose bound is non-nullable.
22302
22301
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23615,15 +23614,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23615
23614
23616
23615
\LMHash{}%
23617
23616
We define the auxiliary function \NominalTypeDepthName{}
23618
- on interface types and \code{Object?} as follows:
23617
+ on interface types as follows:
23619
23618
23620
23619
\begin{itemize}
23621
23620
\item
23622
- \DefEquals{\NominalTypeDepth{Object?}}{0}.
23623
- \item
23624
- \DefEquals{\NominalTypeDepth{Object}}{1}.
23625
- \item
23626
- \DefEquals{\NominalTypeDepth{Null}}{1}.
23621
+ % We could make it 1 rather than 0, to "reserve space" for `Object?`,
23622
+ % but this function is never used with `Object?` anyway.
23623
+ \DefEquals{\NominalTypeDepth{Object}}{0}.
23627
23624
\item
23628
23625
Let $T$ be a class or a mixin,
23629
23626
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23632,10 +23629,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23632
23629
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
23633
23630
\end{itemize}
23634
23631
23635
- \commentary{%
23636
-
23637
- }
23638
-
23639
23632
\LMHash{}%
23640
23633
\BlindDefineSymbol{I, J, M}%
23641
23634
The algorithm that determines
@@ -24024,21 +24017,22 @@ \subsection{Interface Types}
24024
24017
(\ref{typedef}).
24025
24018
We say that $T$ is an \Index{interface type} if{}f
24026
24019
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24027
- where $C$ denotes a class different from \code{Never},
24020
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24028
24021
or $C$ denotes a mixin.
24029
24022
24030
24023
\commentary{%
24031
24024
Note that \List{T}{1}{k} can be arbitrary types.
24032
24025
Non-generic classes are included because we can have $k = 0$.
24033
24026
24034
24027
In particular, the following types are \emph{not} interface types:
24035
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24028
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24029
+ \code{Never}, \code{Null},
24036
24030
any function type, any type variable, any intersection type,
24037
24031
and any type of the form \code{$T$?}.
24038
24032
24039
- Conversely, built-in classes
24040
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24041
- \code{String}, and \code{Exception} are interface types,
24033
+ Conversely, built-in classes like, e.g.,
24034
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24035
+ are interface types,
24042
24036
and so are
24043
24037
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24044
24038
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments