@@ -21453,7 +21453,8 @@ \section{Types}
21453
21453
\LMLabel{types}
21454
21454
21455
21455
\LMHash{}%
21456
- Dart supports optional typing based on interface types.
21456
+ Dart supports optional typing based on interface types
21457
+ (\ref{interfaceTypes}).
21457
21458
21458
21459
\rationale{%
21459
21460
The type system is unsound, due to the covariance of generic classes.
@@ -22187,8 +22188,7 @@ \subsection{Subtypes}
22187
22188
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22188
22189
% ------------------------------------------------ Right Object
22189
22190
\RuleRaw{\SrnRightObjectFour}{%
22190
- \mbox{$S$ is an interface type,}\\
22191
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22191
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22192
22192
% ------------------------------------------------ Left Null 2
22193
22193
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22194
22194
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22563,8 +22563,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22563
22563
\Item{\SrnBottom}{Bottom}
22564
22564
\code{Never} is a subtype of every type.
22565
22565
\Item{\SrnRightObjectFour}{Right Object}
22566
- Interface types, function types, and \FUNCTION{}
22567
- are subtypes of \code{Object}.
22566
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22568
22567
\Item{\SrnNullOne}{Null Nullable}
22569
22568
\code{Null} is a subtype of every type of the form \code{$T$?}.
22570
22569
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22753,7 +22752,7 @@ \subsection{Type Nullability}
22753
22752
\item \code{Never}.
22754
22753
\item Any function type.
22755
22754
\item The type \FUNCTION.
22756
- \item Any interface type except \code{Null} .
22755
+ \item Any interface type.
22757
22756
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22758
22757
\item Any type variable $X$ whose bound is non-nullable.
22759
22758
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24079,8 +24078,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24079
24078
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24080
24079
\item
24081
24080
\DefEquals{\NominalTypeDepth{Object}}{1}.
24082
- \item
24083
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24084
24081
\item
24085
24082
Let $T$ be a class or a mixin,
24086
24083
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24089,10 +24086,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24089
24086
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24090
24087
\end{itemize}
24091
24088
24092
- \commentary{%
24093
-
24094
- }
24095
-
24096
24089
\LMHash{}%
24097
24090
\BlindDefineSymbol{I, J, M}%
24098
24091
The algorithm that determines
@@ -24481,21 +24474,22 @@ \subsection{Interface Types}
24481
24474
(\ref{typedef}).
24482
24475
We say that $T$ is an \Index{interface type} if{}f
24483
24476
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24484
- where $C$ denotes a class different from \code{Never},
24477
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24485
24478
or $C$ denotes a mixin.
24486
24479
24487
24480
\commentary{%
24488
24481
Note that \List{T}{1}{k} can be arbitrary types.
24489
24482
Non-generic classes are included because we can have $k = 0$.
24490
24483
24491
24484
In particular, the following types are \emph{not} interface types:
24492
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24485
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24486
+ \code{Never}, \code{Null},
24493
24487
any function type, any type variable, any intersection type,
24494
24488
and any type of the form \code{$T$?}.
24495
24489
24496
- Conversely, built-in classes
24497
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24498
- \code{String}, and \code{Exception} are interface types,
24490
+ Conversely, built-in classes like
24491
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24492
+ are interface types,
24499
24493
and so are
24500
24494
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24501
24495
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments