@@ -21763,7 +21763,8 @@ \section{Types}
21763
21763
\LMLabel{types}
21764
21764
21765
21765
\LMHash{}%
21766
- Dart supports static typing based on interface types.
21766
+ Dart supports static typing based on interface types
21767
+ (\ref{interfaceTypes}).
21767
21768
21768
21769
\rationale{%
21769
21770
The type system is sound in the sense that
@@ -22508,8 +22509,7 @@ \subsection{Subtypes}
22508
22509
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22509
22510
% ------------------------------------------------ Right Object
22510
22511
\RuleRaw{\SrnRightObjectFour}{%
22511
- \mbox{$S$ is an interface type,}\\
22512
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22512
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22513
22513
% ------------------------------------------------ Left Null 2
22514
22514
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22515
22515
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22884,8 +22884,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22884
22884
\Item{\SrnBottom}{Bottom}
22885
22885
\code{Never} is a subtype of every type.
22886
22886
\Item{\SrnRightObjectFour}{Right Object}
22887
- Interface types, function types, and \FUNCTION{}
22888
- are subtypes of \code{Object}.
22887
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22889
22888
\Item{\SrnNullOne}{Null Nullable}
22890
22889
\code{Null} is a subtype of every type of the form \code{$T$?}.
22891
22890
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23074,7 +23073,7 @@ \subsection{Type Nullability}
23074
23073
\item \code{Never}.
23075
23074
\item Any function type.
23076
23075
\item The type \FUNCTION.
23077
- \item Any interface type except \code{Null} .
23076
+ \item Any interface type.
23078
23077
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
23079
23078
\item Any type variable $X$ whose bound is non-nullable.
23080
23079
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24400,8 +24399,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24400
24399
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24401
24400
\item
24402
24401
\DefEquals{\NominalTypeDepth{Object}}{1}.
24403
- \item
24404
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24405
24402
\item
24406
24403
Let $T$ be a class or a mixin,
24407
24404
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24410,10 +24407,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24410
24407
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24411
24408
\end{itemize}
24412
24409
24413
- \commentary{%
24414
-
24415
- }
24416
-
24417
24410
\LMHash{}%
24418
24411
\BlindDefineSymbol{I, J, M}%
24419
24412
The algorithm that determines
@@ -24802,21 +24795,22 @@ \subsection{Interface Types}
24802
24795
(\ref{typedef}).
24803
24796
We say that $T$ is an \Index{interface type} if{}f
24804
24797
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24805
- where $C$ denotes a class different from \code{Never},
24798
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24806
24799
or $C$ denotes a mixin.
24807
24800
24808
24801
\commentary{%
24809
24802
Note that \List{T}{1}{k} can be arbitrary types.
24810
24803
Non-generic classes are included because we can have $k = 0$.
24811
24804
24812
24805
In particular, the following types are \emph{not} interface types:
24813
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24806
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24807
+ \code{Never}, \code{Null},
24814
24808
any function type, any type variable, any intersection type,
24815
24809
and any type of the form \code{$T$?}.
24816
24810
24817
- Conversely, built-in classes
24818
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24819
- \code{String}, and \code{Exception} are interface types,
24811
+ Conversely, built-in classes like
24812
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24813
+ are interface types,
24820
24814
and so are
24821
24815
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24822
24816
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments