@@ -21235,7 +21235,8 @@ \section{Types}
21235
21235
\LMLabel{types}
21236
21236
21237
21237
\LMHash{}%
21238
- Dart supports optional typing based on interface types.
21238
+ Dart supports optional typing based on interface types
21239
+ (\ref{interfaceTypes}).
21239
21240
21240
21241
\rationale{%
21241
21242
The type system is unsound, due to the covariance of generic classes.
@@ -21969,8 +21970,7 @@ \subsection{Subtypes}
21969
21970
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
21970
21971
% ------------------------------------------------ Right Object
21971
21972
\RuleRaw{\SrnRightObjectFour}{%
21972
- \mbox{$S$ is an interface type,}\\
21973
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
21973
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
21974
21974
% ------------------------------------------------ Left Null 2
21975
21975
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
21976
21976
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22345,8 +22345,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22345
22345
\Item{\SrnBottom}{Bottom}
22346
22346
\code{Never} is a subtype of every type.
22347
22347
\Item{\SrnRightObjectFour}{Right Object}
22348
- Interface types, function types, and \FUNCTION{}
22349
- are subtypes of \code{Object}.
22348
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22350
22349
\Item{\SrnNullOne}{Null Nullable}
22351
22350
\code{Null} is a subtype of every type of the form \code{$T$?}.
22352
22351
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22535,7 +22534,7 @@ \subsection{Type Nullability}
22535
22534
\item \code{Never}.
22536
22535
\item Any function type.
22537
22536
\item The type \FUNCTION.
22538
- \item Any interface type except \code{Null} .
22537
+ \item Any interface type.
22539
22538
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22540
22539
\item Any type variable $X$ whose bound is non-nullable.
22541
22540
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23861,8 +23860,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23861
23860
\DefEquals{\NominalTypeDepth{Object?}}{0}.
23862
23861
\item
23863
23862
\DefEquals{\NominalTypeDepth{Object}}{1}.
23864
- \item
23865
- \DefEquals{\NominalTypeDepth{Null}}{1}.
23866
23863
\item
23867
23864
Let $T$ be a class or a mixin,
23868
23865
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23871,10 +23868,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23871
23868
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
23872
23869
\end{itemize}
23873
23870
23874
- \commentary{%
23875
-
23876
- }
23877
-
23878
23871
\LMHash{}%
23879
23872
\BlindDefineSymbol{I, J, M}%
23880
23873
The algorithm that determines
@@ -24263,21 +24256,22 @@ \subsection{Interface Types}
24263
24256
(\ref{typedef}).
24264
24257
We say that $T$ is an \Index{interface type} if{}f
24265
24258
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24266
- where $C$ denotes a class different from \code{Never},
24259
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24267
24260
or $C$ denotes a mixin.
24268
24261
24269
24262
\commentary{%
24270
24263
Note that \List{T}{1}{k} can be arbitrary types.
24271
24264
Non-generic classes are included because we can have $k = 0$.
24272
24265
24273
24266
In particular, the following types are \emph{not} interface types:
24274
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24267
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24268
+ \code{Never}, \code{Null},
24275
24269
any function type, any type variable, any intersection type,
24276
24270
and any type of the form \code{$T$?}.
24277
24271
24278
- Conversely, built-in classes
24279
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24280
- \code{String}, and \code{Exception} are interface types,
24272
+ Conversely, built-in classes like
24273
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24274
+ are interface types,
24281
24275
and so are
24282
24276
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24283
24277
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments