@@ -20924,7 +20924,8 @@ \section{Types}
2092420924\LMLabel{types}
2092520925
2092620926\LMHash{}%
20927- Dart supports static typing based on interface types.
20927+ Dart supports static typing based on interface types
20928+ (\ref{interfaceTypes}).
2092820929
2092920930\rationale{%
2093020931The type system is sound in the sense that
@@ -21731,8 +21732,7 @@ \subsection{Subtypes}
2173121732 T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2173221733 % ------------------------------------------------ Right Object
2173321734 \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}}
2173621736 % ------------------------------------------------ Left Null 2
2173721737 \Rule{\SrnNullTwo}{\code{Null}}{T}{%
2173821738 \code{Null}}{\code{FutureOr<$T$>}}
@@ -22107,8 +22107,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2210722107\Item{\SrnBottom}{Bottom}
2210822108 \code{Never} is a subtype of every type.
2210922109\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}.
2211222111\Item{\SrnNullOne}{Null Nullable}
2211322112 \code{Null} is a subtype of every type of the form \code{$T$?}.
2211422113\Item{\SrnNullTwo}{Null FutureOr}
@@ -22296,7 +22295,7 @@ \subsection{Type Nullability}
2229622295\item \code{Never}.
2229722296\item Any function type.
2229822297\item The type \FUNCTION.
22299- \item Any interface type except \code{Null} .
22298+ \item Any interface type.
2230022299\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2230122300\item Any type variable $X$ whose bound is non-nullable.
2230222301\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23615,15 +23614,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2361523614
2361623615\LMHash{}%
2361723616We define the auxiliary function \NominalTypeDepthName{}
23618- on interface types and \code{Object?} as follows:
23617+ on interface types as follows:
2361923618
2362023619\begin{itemize}
2362123620\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}.
2362723624\item
2362823625 Let $T$ be a class or a mixin,
2362923626 and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23632,10 +23629,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2363223629 $\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2363323630\end{itemize}
2363423631
23635- \commentary{%
23636-
23637- }
23638-
2363923632\LMHash{}%
2364023633\BlindDefineSymbol{I, J, M}%
2364123634The algorithm that determines
@@ -24024,21 +24017,22 @@ \subsection{Interface Types}
2402424017(\ref{typedef}).
2402524018We say that $T$ is an \Index{interface type} if{}f
2402624019$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} ,
2402824021or $C$ denotes a mixin.
2402924022
2403024023\commentary{%
2403124024Note that \List{T}{1}{k} can be arbitrary types.
2403224025Non-generic classes are included because we can have $k = 0$.
2403324026
2403424027In 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},
2403624030any function type, any type variable, any intersection type,
2403724031and any type of the form \code{$T$?}.
2403824032
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,
2404224036and so are
2404324037\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2404424038\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments