@@ -22191,7 +22191,8 @@ \section{Types}
22191
22191
\LMLabel{types}
22192
22192
22193
22193
\LMHash{}%
22194
- Dart supports static typing based on interface types.
22194
+ Dart supports static typing based on interface types
22195
+ (\ref{interfaceTypes}).
22195
22196
22196
22197
\rationale{%
22197
22198
The type system is sound in the sense that
@@ -22939,8 +22940,7 @@ \subsection{Subtypes}
22939
22940
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22940
22941
% ------------------------------------------------ Right Object
22941
22942
\RuleRaw{\SrnRightObjectFour}{%
22942
- \mbox{$S$ is an interface type,}\\
22943
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22943
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22944
22944
% ------------------------------------------------ Left Null 2
22945
22945
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22946
22946
\code{Null}}{\code{FutureOr<$T$>}}
@@ -23317,8 +23317,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
23317
23317
\Item{\SrnBottom}{Bottom}
23318
23318
\code{Never} is a subtype of every type.
23319
23319
\Item{\SrnRightObjectFour}{Right Object}
23320
- Interface types, function types, and \FUNCTION{}
23321
- are subtypes of \code{Object}.
23320
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
23322
23321
\Item{\SrnNullOne}{Null Nullable}
23323
23322
\code{Null} is a subtype of every type of the form \code{$T$?}.
23324
23323
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23507,7 +23506,7 @@ \subsection{Type Nullability}
23507
23506
\item \code{Never}.
23508
23507
\item Any function type.
23509
23508
\item The type \FUNCTION.
23510
- \item Any interface type except \code{Null} .
23509
+ \item Any interface type.
23511
23510
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
23512
23511
\item Any type variable $X$ whose bound is non-nullable.
23513
23512
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24833,8 +24832,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24833
24832
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24834
24833
\item
24835
24834
\DefEquals{\NominalTypeDepth{Object}}{1}.
24836
- \item
24837
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24838
24835
\item
24839
24836
Let $T$ be a class or a mixin,
24840
24837
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24843,10 +24840,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24843
24840
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24844
24841
\end{itemize}
24845
24842
24846
- \commentary{%
24847
-
24848
- }
24849
-
24850
24843
\LMHash{}%
24851
24844
\BlindDefineSymbol{I, J, M}%
24852
24845
The algorithm that determines
@@ -25236,21 +25229,22 @@ \subsection{Interface Types}
25236
25229
(\ref{typedef}).
25237
25230
We say that $T$ is an \Index{interface type} if{}f
25238
25231
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
25239
- where $C$ denotes a class different from \code{Never},
25232
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
25240
25233
or $C$ denotes a mixin.
25241
25234
25242
25235
\commentary{%
25243
25236
Note that \List{T}{1}{k} can be arbitrary types.
25244
25237
Non-generic classes are included because we can have $k = 0$.
25245
25238
25246
25239
In particular, the following types are \emph{not} interface types:
25247
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
25240
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
25241
+ \code{Never}, \code{Null},
25248
25242
any function type, any type variable, any intersection type,
25249
25243
and any type of the form \code{$T$?}.
25250
25244
25251
- Conversely, built-in classes
25252
- like \code{Object}, \code{Null }, \code{num }, \code{int},
25253
- \code{String}, and \code{Exception} are interface types,
25245
+ Conversely, built-in classes like
25246
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
25247
+ are interface types,
25254
25248
and so are
25255
25249
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
25256
25250
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments