@@ -19966,7 +19966,8 @@ \section{Types}
1996619966\LMLabel{types}
1996719967
1996819968\LMHash{}%
19969- Dart supports optional typing based on interface types.
19969+ Dart supports optional typing based on interface types
19970+ (\ref{interfaceTypes}).
1997019971
1997119972\rationale{%
1997219973The type system is unsound, due to the covariance of generic classes.
@@ -20766,8 +20767,7 @@ \subsection{Subtypes}
2076620767 T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2076720768 % ------------------------------------------------ Right Object
2076820769 \RuleRaw{\SrnRightObjectFour}{%
20769- \mbox{$S$ is an interface type,}\\
20770- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
20770+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2077120771 % ------------------------------------------------ Left Null 2
2077220772 \Rule{\SrnNullTwo}{\code{Null}}{T}{%
2077320773 \code{Null}}{\code{FutureOr<$T$>}}
@@ -21142,8 +21142,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2114221142\Item{\SrnBottom}{Bottom}
2114321143 \code{Never} is a subtype of every type.
2114421144\Item{\SrnRightObjectFour}{Right Object}
21145- Interface types, function types, and \FUNCTION{}
21146- are subtypes of \code{Object}.
21145+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
2114721146\Item{\SrnNullOne}{Null Nullable}
2114821147 \code{Null} is a subtype of every type of the form \code{$T$?}.
2114921148\Item{\SrnNullTwo}{Null FutureOr}
@@ -21331,7 +21330,7 @@ \subsection{Type Nullability}
2133121330\item \code{Never}.
2133221331\item Any function type.
2133321332\item The type \FUNCTION.
21334- \item Any interface type except \code{Null} .
21333+ \item Any interface type.
2133521334\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2133621335\item Any type variable $X$ whose bound is non-nullable.
2133721336\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -22650,15 +22649,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2265022649
2265122650\LMHash{}%
2265222651We define the auxiliary function \NominalTypeDepthName{}
22653- on interface types and \code{Object?} as follows:
22652+ on interface types as follows:
2265422653
2265522654\begin{itemize}
2265622655\item
22657- \DefEquals{\NominalTypeDepth{Object?}}{0}.
22658- \item
22659- \DefEquals{\NominalTypeDepth{Object}}{1}.
22660- \item
22661- \DefEquals{\NominalTypeDepth{Null}}{1}.
22656+ % We could make it 1 rather than 0, to "reserve space" for `Object?`,
22657+ % but this function is never used with `Object?` anyway.
22658+ \DefEquals{\NominalTypeDepth{Object}}{0}.
2266222659\item
2266322660 Let $T$ be a class or a mixin,
2266422661 and let $M$ be the set of immediate superinterfaces of $T$.
@@ -22667,10 +22664,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2266722664 $\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2266822665\end{itemize}
2266922666
22670- \commentary{%
22671-
22672- }
22673-
2267422667\LMHash{}%
2267522668\BlindDefineSymbol{I, J, M}%
2267622669The algorithm that determines
@@ -23059,21 +23052,22 @@ \subsection{Interface Types}
2305923052(\ref{typedef}).
2306023053We say that $T$ is an \Index{interface type} if{}f
2306123054$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
23062- where $C$ denotes a class different from \code{Never},
23055+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
2306323056or $C$ denotes a mixin.
2306423057
2306523058\commentary{%
2306623059Note that \List{T}{1}{k} can be arbitrary types.
2306723060Non-generic classes are included because we can have $k = 0$.
2306823061
2306923062In particular, the following types are \emph{not} interface types:
23070- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
23063+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
23064+ \code{Never}, \code{Null},
2307123065any function type, any type variable, any intersection type,
2307223066and any type of the form \code{$T$?}.
2307323067
23074- Conversely, built-in classes
23075- like \code{Object}, \code{Null }, \code{num }, \code{int},
23076- \code{String}, and \code{Exception} are interface types,
23068+ Conversely, built-in classes like, e.g.,
23069+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
23070+ are interface types,
2307723071and so are
2307823072\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2307923073\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments