@@ -20736,7 +20736,8 @@ \section{Types}
20736
20736
\LMLabel{types}
20737
20737
20738
20738
\LMHash{}%
20739
- Dart supports static typing based on interface types.
20739
+ Dart supports static typing based on interface types
20740
+ (\ref{interfaceTypes}).
20740
20741
20741
20742
\rationale{%
20742
20743
The type system is sound in the sense that
@@ -21543,8 +21544,7 @@ \subsection{Subtypes}
21543
21544
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
21544
21545
% ------------------------------------------------ Right Object
21545
21546
\RuleRaw{\SrnRightObjectFour}{%
21546
- \mbox{$S$ is an interface type,}\\
21547
- \mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
21547
+ \mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
21548
21548
% ------------------------------------------------ Left Null 2
21549
21549
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
21550
21550
\code{Null}}{\code{FutureOr<$T$>}}
@@ -21919,8 +21919,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
21919
21919
\Item{\SrnBottom}{Bottom}
21920
21920
\code{Never} is a subtype of every type.
21921
21921
\Item{\SrnRightObjectFour}{Right Object}
21922
- Interface types, function types, and \FUNCTION{}
21923
- are subtypes of \code{Object}.
21922
+ Interface types and \FUNCTION{} are subtypes of \code{Object}.
21924
21923
\Item{\SrnNullOne}{Null Nullable}
21925
21924
\code{Null} is a subtype of every type of the form \code{$T$?}.
21926
21925
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22108,7 +22107,7 @@ \subsection{Type Nullability}
22108
22107
\item \code{Never}.
22109
22108
\item Any function type.
22110
22109
\item The type \FUNCTION.
22111
- \item Any interface type except \code{Null} .
22110
+ \item Any interface type.
22112
22111
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
22113
22112
\item Any type variable $X$ whose bound is non-nullable.
22114
22113
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23427,15 +23426,13 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23427
23426
23428
23427
\LMHash{}%
23429
23428
We define the auxiliary function \NominalTypeDepthName{}
23430
- on interface types and \code{Object?} as follows:
23429
+ on interface types as follows:
23431
23430
23432
23431
\begin{itemize}
23433
23432
\item
23434
- \DefEquals{\NominalTypeDepth{Object?}}{0}.
23435
- \item
23436
- \DefEquals{\NominalTypeDepth{Object}}{1}.
23437
- \item
23438
- \DefEquals{\NominalTypeDepth{Null}}{1}.
23433
+ % We could make it 1 rather than 0, to "reserve space" for `Object?`,
23434
+ % but this function is never used with `Object?` anyway.
23435
+ \DefEquals{\NominalTypeDepth{Object}}{0}.
23439
23436
\item
23440
23437
Let $T$ be a class or a mixin,
23441
23438
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23444,10 +23441,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
23444
23441
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
23445
23442
\end{itemize}
23446
23443
23447
- \commentary{%
23448
-
23449
- }
23450
-
23451
23444
\LMHash{}%
23452
23445
\BlindDefineSymbol{I, J, M}%
23453
23446
The algorithm that determines
@@ -23836,21 +23829,22 @@ \subsection{Interface Types}
23836
23829
(\ref{typedef}).
23837
23830
We say that $T$ is an \Index{interface type} if{}f
23838
23831
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
23839
- where $C$ denotes a class different from \code{Never},
23832
+ where $C$ denotes a class different from \code{Never} and \code{Null} ,
23840
23833
or $C$ denotes a mixin.
23841
23834
23842
23835
\commentary{%
23843
23836
Note that \List{T}{1}{k} can be arbitrary types.
23844
23837
Non-generic classes are included because we can have $k = 0$.
23845
23838
23846
23839
In particular, the following types are \emph{not} interface types:
23847
- \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
23840
+ \VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
23841
+ \code{Never}, \code{Null},
23848
23842
any function type, any type variable, any intersection type,
23849
23843
and any type of the form \code{$T$?}.
23850
23844
23851
- Conversely, built-in classes
23852
- like \code{Object}, \code{Null }, \code{num }, \code{int},
23853
- \code{String}, and \code{Exception} are interface types,
23845
+ Conversely, built-in classes like, e.g.,
23846
+ \code{Object}, \code{num }, \code{int }, \code{String}, and \code{Exception}
23847
+ are interface types,
23854
23848
and so are
23855
23849
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
23856
23850
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},
0 commit comments