@@ -21738,7 +21738,8 @@ \section{Types}
21738
21738
\LMLabel{types}
21739
21739
21740
21740
\LMHash{}%
21741
- Dart supports static typing based on interface types.
21741
+ Dart supports static typing based on interface types
21742
+ (\ref{interfaceTypes}).
21742
21743
21743
21744
\rationale{%
21744
21745
The type system is sound in the sense that
@@ -22488,8 +22489,7 @@ \subsection{Subtypes}
22488
22489
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
22489
22490
% ------------------------------------------------ Right Object
22490
22491
\RuleRaw{\SrnRightObjectFour}{%
22491
- \mbox{$S$ is an interface type,}\\
22492
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22492
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
22493
22493
% ------------------------------------------------ Left Null 2
22494
22494
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
22495
22495
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22864,8 +22864,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
22864
22864
\Item{\SrnBottom}{Bottom}
22865
22865
\code{Never} is a subtype of every type.
22866
22866
\Item{\SrnRightObjectFour}{Right Object}
22867
- Interface types, function types, and \FUNCTION{}
22868
- are subtypes of \code{Object}.
22867
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
22869
22868
\Item{\SrnNullOne}{Null Nullable}
22870
22869
\code{Null} is a subtype of every type of the form \code{$T$?}.
22871
22870
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23054,7 +23053,7 @@ \subsection{Type Nullability}
23054
23053
\item \code{Never}.
23055
23054
\item Any function type.
23056
23055
\item The type \FUNCTION.
23057
- \item Any interface type except \code{Null} .
23056
+ \item Any interface type.
23058
23057
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
23059
23058
\item Any type variable $X$ whose bound is non-nullable.
23060
23059
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24380,8 +24379,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24380
24379
\DefEquals{\NominalTypeDepth{Object?}}{0}.
24381
24380
\item
24382
24381
\DefEquals{\NominalTypeDepth{Object}}{1}.
24383
- \item
24384
- \DefEquals{\NominalTypeDepth{Null}}{1}.
24385
24382
\item
24386
24383
Let $T$ be a class or a mixin,
24387
24384
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24390,10 +24387,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
24390
24387
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
24391
24388
\end{itemize}
24392
24389
24393
- \commentary{%
24394
-
24395
- }
24396
-
24397
24390
\LMHash{}%
24398
24391
\BlindDefineSymbol{I, J, M}%
24399
24392
The algorithm that determines
@@ -24782,21 +24775,22 @@ \subsection{Interface Types}
24782
24775
(\ref{typedef}).
24783
24776
We say that $T$ is an \Index{interface type} if{}f
24784
24777
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24785
- where $C$ denotes a class different from \code{Never},
24778
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
24786
24779
or $C$ denotes a mixin.
24787
24780
24788
24781
\commentary{%
24789
24782
Note that \List{T}{1}{k} can be arbitrary types.
24790
24783
Non-generic classes are included because we can have $k = 0$.
24791
24784
24792
24785
In particular, the following types are \emph{not} interface types:
24793
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24786
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24787
+ \code{Never}, \code{Null},
24794
24788
any function type, any type variable, any intersection type,
24795
24789
and any type of the form \code{$T$?}.
24796
24790
24797
- Conversely, built-in classes
24798
- like \code{Object}, \code{Null }, \code{num }, \code{int},
24799
- \code{String}, and \code{Exception} are interface types,
24791
+ Conversely, built-in classes like
24792
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
24793
+ are interface types,
24800
24794
and so are
24801
24795
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
24802
24796
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments