@@ -21387,7 +21387,8 @@ \section{Types}
21387
21387
\LMLabel{types}
21388
21388
21389
21389
\LMHash{}%
21390
- Dart supports optional typing based on interface types.
21390
+ Dart supports optional typing based on interface types
21391
+ (\ref{interfaceTypes}).
21391
21392
21392
21393
\rationale{%
21393
21394
The type system is unsound, due to the covariance of generic classes.
@@ -22121,8 +22122,7 @@ \subsection{Subtypes}
22121
22122
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22122
22123
% ------------------------------------------------ Right Object
22123
22124
\RuleRaw{\SrnRightObjectFour}{%
22124
- \mbox{$S$ is an interface type,}\\
22125
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22125
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22126
22126
% ------------------------------------------------ Left Null 2
22127
22127
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22128
22128
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22497,8 +22497,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22497
22497
\Item{\SrnBottom}{Bottom}
22498
22498
\code{Never} is a subtype of every type.
22499
22499
\Item{\SrnRightObjectFour}{Right Object}
22500
- Interface types, function types, and \FUNCTION{}
22501
- are subtypes of \code{Object}.
22500
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22502
22501
\Item{\SrnNullOne}{Null Nullable}
22503
22502
\code{Null} is a subtype of every type of the form \code{$T$?}.
22504
22503
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22687,7 +22686,7 @@ \subsection{Type Nullability}
22687
22686
\item \code{Never}.
22688
22687
\item Any function type.
22689
22688
\item The type \FUNCTION.
22690
- \item Any interface type except \code{Null} .
22689
+ \item Any interface type.
22691
22690
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22692
22691
\item Any type variable $X$ whose bound is non-nullable.
22693
22692
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24013,8 +24012,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24013
24012
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24014
24013
\item
24015
24014
\DefEquals{\NominalTypeDepth{Object}}{1}.
24016
- \item
24017
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24018
24015
\item
24019
24016
Let $T$ be a class or a mixin,
24020
24017
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24023,10 +24020,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24023
24020
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24024
24021
\end{itemize}
24025
24022
24026
- \commentary{%
24027
-
24028
- }
24029
-
24030
24023
\LMHash{}%
24031
24024
\BlindDefineSymbol{I, J, M}%
24032
24025
The algorithm that determines
@@ -24415,21 +24408,22 @@ \subsection{Interface Types}
24415
24408
(\ref{typedef}).
24416
24409
We say that $T$ is an \Index{interface type} if{}f
24417
24410
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24418
- where $C$ denotes a class different from \code{Never},
24411
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24419
24412
or $C$ denotes a mixin.
24420
24413
24421
24414
\commentary{%
24422
24415
Note that \List{T}{1}{k} can be arbitrary types.
24423
24416
Non-generic classes are included because we can have $k = 0$.
24424
24417
24425
24418
In particular, the following types are \emph{not} interface types:
24426
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24419
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24420
+ \code{Never}, \code{Null},
24427
24421
any function type, any type variable, any intersection type,
24428
24422
and any type of the form \code{$T$?}.
24429
24423
24430
- Conversely, built-in classes
24431
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24432
- \code{String}, and \code{Exception} are interface types,
24424
+ Conversely, built-in classes like
24425
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24426
+ are interface types,
24433
24427
and so are
24434
24428
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24435
24429
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments