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