@@ -19958,7 +19958,8 @@ \section{Types}
1995819958\LMLabel{types}
1995919959
1996019960\LMHash{}%
19961- Dart supports optional typing based on interface types.
19961+ Dart supports optional typing based on interface types
19962+ (\ref{interfaceTypes}).
1996219963
1996319964\rationale{%
1996419965The type system is unsound, due to the covariance of generic classes.
@@ -20758,8 +20759,7 @@ \subsection{Subtypes}
2075820759 T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2075920760 % ------------------------------------------------ Right Object
2076020761 \RuleRaw{\SrnRightObjectFour}{%
20761- \mbox{$S$ is an interface type,}\\
20762- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
20762+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2076320763 % ------------------------------------------------ Left Null 2
2076420764 \Rule{\SrnNullTwo}{\code{Null}}{T}{%
2076520765 \code{Null}}{\code{FutureOr<$T$>}}
@@ -21134,8 +21134,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2113421134\Item{\SrnBottom}{Bottom}
2113521135 \code{Never} is a subtype of every type.
2113621136\Item{\SrnRightObjectFour}{Right Object}
21137- Interface types, function types, and \FUNCTION{}
21138- are subtypes of \code{Object}.
21137+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
2113921138\Item{\SrnNullOne}{Null Nullable}
2114021139 \code{Null} is a subtype of every type of the form \code{$T$?}.
2114121140\Item{\SrnNullTwo}{Null FutureOr}
@@ -21323,7 +21322,7 @@ \subsection{Type Nullability}
2132321322\item \code{Never}.
2132421323\item Any function type.
2132521324\item The type \FUNCTION.
21326- \item Any interface type except \code{Null} .
21325+ \item Any interface type.
2132721326\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2132821327\item Any type variable $X$ whose bound is non-nullable.
2132921328\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -22642,15 +22641,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2264222641
2264322642\LMHash{}%
2264422643We define the auxiliary function \NominalTypeDepthName{}
22645- on interface types and \code{Object?} as follows:
22644+ on interface types as follows:
2264622645
2264722646\begin{itemize}
2264822647\item
22649- \DefEquals{\NominalTypeDepth{Object?}}{0}.
22650- \item
22651- \DefEquals{\NominalTypeDepth{Object}}{1}.
22652- \item
22653- \DefEquals{\NominalTypeDepth{Null}}{1}.
22648+ % We could make it 1 rather than 0, to "reserve space" for `Object?`,
22649+ % but this function is never used with `Object?` anyway.
22650+ \DefEquals{\NominalTypeDepth{Object}}{0}.
2265422651\item
2265522652 Let $T$ be a class or a mixin,
2265622653 and let $M$ be the set of immediate superinterfaces of $T$.
@@ -22659,10 +22656,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2265922656 $\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2266022657\end{itemize}
2266122658
22662- \commentary{%
22663-
22664- }
22665-
2266622659\LMHash{}%
2266722660\BlindDefineSymbol{I, J, M}%
2266822661The algorithm that determines
@@ -23051,21 +23044,22 @@ \subsection{Interface Types}
2305123044(\ref{typedef}).
2305223045We say that $T$ is an \Index{interface type} if{}f
2305323046$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
23054- where $C$ denotes a class different from \code{Never},
23047+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
2305523048or $C$ denotes a mixin.
2305623049
2305723050\commentary{%
2305823051Note that \List{T}{1}{k} can be arbitrary types.
2305923052Non-generic classes are included because we can have $k = 0$.
2306023053
2306123054In particular, the following types are \emph{not} interface types:
23062- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
23055+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
23056+ \code{Never}, \code{Null},
2306323057any function type, any type variable, any intersection type,
2306423058and any type of the form \code{$T$?}.
2306523059
23066- Conversely, built-in classes
23067- like \code{Object}, \code{Null }, \code{num }, \code{int},
23068- \code{String}, and \code{Exception} are interface types,
23060+ Conversely, built-in classes like, e.g.,
23061+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
23062+ are interface types,
2306923063and so are
2307023064\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2307123065\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments