@@ -19947,7 +19947,8 @@ \section{Types}
1994719947\LMLabel{types}
1994819948
1994919949\LMHash{}%
19950- Dart supports optional typing based on interface types.
19950+ Dart supports optional typing based on interface types
19951+ (\ref{interfaceTypes}).
1995119952
1995219953\rationale{%
1995319954The type system is unsound, due to the covariance of generic classes.
@@ -20747,8 +20748,7 @@ \subsection{Subtypes}
2074720748 T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2074820749 % ------------------------------------------------ Right Object
2074920750 \RuleRaw{\SrnRightObjectFour}{%
20750- \mbox{$S$ is an interface type,}\\
20751- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
20751+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2075220752 % ------------------------------------------------ Left Null 2
2075320753 \Rule{\SrnNullTwo}{\code{Null}}{T}{%
2075420754 \code{Null}}{\code{FutureOr<$T$>}}
@@ -21123,8 +21123,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2112321123\Item{\SrnBottom}{Bottom}
2112421124 \code{Never} is a subtype of every type.
2112521125\Item{\SrnRightObjectFour}{Right Object}
21126- Interface types, function types, and \FUNCTION{}
21127- are subtypes of \code{Object}.
21126+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
2112821127\Item{\SrnNullOne}{Null Nullable}
2112921128 \code{Null} is a subtype of every type of the form \code{$T$?}.
2113021129\Item{\SrnNullTwo}{Null FutureOr}
@@ -21312,7 +21311,7 @@ \subsection{Type Nullability}
2131221311\item \code{Never}.
2131321312\item Any function type.
2131421313\item The type \FUNCTION.
21315- \item Any interface type except \code{Null} .
21314+ \item Any interface type.
2131621315\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2131721316\item Any type variable $X$ whose bound is non-nullable.
2131821317\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -22631,15 +22630,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2263122630
2263222631\LMHash{}%
2263322632We define the auxiliary function \NominalTypeDepthName{}
22634- on interface types and \code{Object?} as follows:
22633+ on interface types as follows:
2263522634
2263622635\begin{itemize}
2263722636\item
22638- \DefEquals{\NominalTypeDepth{Object?}}{0}.
22639- \item
22640- \DefEquals{\NominalTypeDepth{Object}}{1}.
22641- \item
22642- \DefEquals{\NominalTypeDepth{Null}}{1}.
22637+ % We could make it 1 rather than 0, to "reserve space" for `Object?`,
22638+ % but this function is never used with `Object?` anyway.
22639+ \DefEquals{\NominalTypeDepth{Object}}{0}.
2264322640\item
2264422641 Let $T$ be a class or a mixin,
2264522642 and let $M$ be the set of immediate superinterfaces of $T$.
@@ -22648,10 +22645,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2264822645 $\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2264922646\end{itemize}
2265022647
22651- \commentary{%
22652-
22653- }
22654-
2265522648\LMHash{}%
2265622649\BlindDefineSymbol{I, J, M}%
2265722650The algorithm that determines
@@ -23040,21 +23033,22 @@ \subsection{Interface Types}
2304023033(\ref{typedef}).
2304123034We say that $T$ is an \Index{interface type} if{}f
2304223035$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
23043- where $C$ denotes a class different from \code{Never},
23036+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
2304423037or $C$ denotes a mixin.
2304523038
2304623039\commentary{%
2304723040Note that \List{T}{1}{k} can be arbitrary types.
2304823041Non-generic classes are included because we can have $k = 0$.
2304923042
2305023043In particular, the following types are \emph{not} interface types:
23051- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
23044+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
23045+ \code{Never}, \code{Null},
2305223046any function type, any type variable, any intersection type,
2305323047and any type of the form \code{$T$?}.
2305423048
23055- Conversely, built-in classes
23056- like \code{Object}, \code{Null }, \code{num }, \code{int},
23057- \code{String}, and \code{Exception} are interface types,
23049+ Conversely, built-in classes like, e.g.,
23050+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
23051+ are interface types,
2305823052and so are
2305923053\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2306023054\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments