@@ -21324,7 +21324,8 @@ \section{Types}
21324
21324
\LMLabel{types}
21325
21325
21326
21326
\LMHash{}%
21327
- Dart supports optional typing based on interface types.
21327
+ Dart supports optional typing based on interface types
21328
+ (\ref{interfaceTypes}).
21328
21329
21329
21330
\rationale{%
21330
21331
The type system is unsound, due to the covariance of generic classes.
@@ -22058,8 +22059,7 @@ \subsection{Subtypes}
22058
22059
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22059
22060
% ------------------------------------------------ Right Object
22060
22061
\RuleRaw{\SrnRightObjectFour}{%
22061
- \mbox{$S$ is an interface type,}\\
22062
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22062
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22063
22063
% ------------------------------------------------ Left Null 2
22064
22064
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22065
22065
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22434,8 +22434,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22434
22434
\Item{\SrnBottom}{Bottom}
22435
22435
\code{Never} is a subtype of every type.
22436
22436
\Item{\SrnRightObjectFour}{Right Object}
22437
- Interface types, function types, and \FUNCTION{}
22438
- are subtypes of \code{Object}.
22437
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22439
22438
\Item{\SrnNullOne}{Null Nullable}
22440
22439
\code{Null} is a subtype of every type of the form \code{$T$?}.
22441
22440
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22624,7 +22623,7 @@ \subsection{Type Nullability}
22624
22623
\item \code{Never}.
22625
22624
\item Any function type.
22626
22625
\item The type \FUNCTION.
22627
- \item Any interface type except \code{Null} .
22626
+ \item Any interface type.
22628
22627
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22629
22628
\item Any type variable $X$ whose bound is non-nullable.
22630
22629
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23950,8 +23949,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23950
23949
\DefEquals{\NominalTypeDepth{Object?}}{0}.
23951
23950
\item
23952
23951
\DefEquals{\NominalTypeDepth{Object}}{1}.
23953
- \item
23954
- \DefEquals{\NominalTypeDepth{Null}}{1}.
23955
23952
\item
23956
23953
Let $T$ be a class or a mixin,
23957
23954
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23960,10 +23957,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23960
23957
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
23961
23958
\end{itemize}
23962
23959
23963
- \commentary{%
23964
-
23965
- }
23966
-
23967
23960
\LMHash{}%
23968
23961
\BlindDefineSymbol{I, J, M}%
23969
23962
The algorithm that determines
@@ -24352,21 +24345,22 @@ \subsection{Interface Types}
24352
24345
(\ref{typedef}).
24353
24346
We say that $T$ is an \Index{interface type} if{}f
24354
24347
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24355
- where $C$ denotes a class different from \code{Never},
24348
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24356
24349
or $C$ denotes a mixin.
24357
24350
24358
24351
\commentary{%
24359
24352
Note that \List{T}{1}{k} can be arbitrary types.
24360
24353
Non-generic classes are included because we can have $k = 0$.
24361
24354
24362
24355
In particular, the following types are \emph{not} interface types:
24363
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24356
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24357
+ \code{Never}, \code{Null},
24364
24358
any function type, any type variable, any intersection type,
24365
24359
and any type of the form \code{$T$?}.
24366
24360
24367
- Conversely, built-in classes
24368
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24369
- \code{String}, and \code{Exception} are interface types,
24361
+ Conversely, built-in classes like
24362
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24363
+ are interface types,
24370
24364
and so are
24371
24365
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24372
24366
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments