@@ -21575,7 +21575,8 @@ \section{Types}
21575
21575
\LMLabel{types}
21576
21576
21577
21577
\LMHash{}%
21578
- Dart supports static typing based on interface types.
21578
+ Dart supports static typing based on interface types
21579
+ (\ref{interfaceTypes}).
21579
21580
21580
21581
\rationale{%
21581
21582
The type system is sound in the sense that
@@ -22325,8 +22326,7 @@ \subsection{Subtypes}
22325
22326
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22326
22327
% ------------------------------------------------ Right Object
22327
22328
\RuleRaw{\SrnRightObjectFour}{%
22328
- \mbox{$S$ is an interface type,}\\
22329
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22329
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22330
22330
% ------------------------------------------------ Left Null 2
22331
22331
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22332
22332
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22701,8 +22701,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22701
22701
\Item{\SrnBottom}{Bottom}
22702
22702
\code{Never} is a subtype of every type.
22703
22703
\Item{\SrnRightObjectFour}{Right Object}
22704
- Interface types, function types, and \FUNCTION{}
22705
- are subtypes of \code{Object}.
22704
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22706
22705
\Item{\SrnNullOne}{Null Nullable}
22707
22706
\code{Null} is a subtype of every type of the form \code{$T$?}.
22708
22707
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22891,7 +22890,7 @@ \subsection{Type Nullability}
22891
22890
\item \code{Never}.
22892
22891
\item Any function type.
22893
22892
\item The type \FUNCTION.
22894
- \item Any interface type except \code{Null} .
22893
+ \item Any interface type.
22895
22894
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22896
22895
\item Any type variable $X$ whose bound is non-nullable.
22897
22896
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24217,8 +24216,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24217
24216
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24218
24217
\item
24219
24218
\DefEquals{\NominalTypeDepth{Object}}{1}.
24220
- \item
24221
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24222
24219
\item
24223
24220
Let $T$ be a class or a mixin,
24224
24221
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24227,10 +24224,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24227
24224
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24228
24225
\end{itemize}
24229
24226
24230
- \commentary{%
24231
-
24232
- }
24233
-
24234
24227
\LMHash{}%
24235
24228
\BlindDefineSymbol{I, J, M}%
24236
24229
The algorithm that determines
@@ -24619,21 +24612,22 @@ \subsection{Interface Types}
24619
24612
(\ref{typedef}).
24620
24613
We say that $T$ is an \Index{interface type} if{}f
24621
24614
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24622
- where $C$ denotes a class different from \code{Never},
24615
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24623
24616
or $C$ denotes a mixin.
24624
24617
24625
24618
\commentary{%
24626
24619
Note that \List{T}{1}{k} can be arbitrary types.
24627
24620
Non-generic classes are included because we can have $k = 0$.
24628
24621
24629
24622
In particular, the following types are \emph{not} interface types:
24630
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24623
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24624
+ \code{Never}, \code{Null},
24631
24625
any function type, any type variable, any intersection type,
24632
24626
and any type of the form \code{$T$?}.
24633
24627
24634
- Conversely, built-in classes
24635
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24636
- \code{String}, and \code{Exception} are interface types,
24628
+ Conversely, built-in classes like
24629
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24630
+ are interface types,
24637
24631
and so are
24638
24632
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24639
24633
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments