Skip to content

Commit 6eae71e

Browse files
committed
Interface type fixes
1 parent 15b519b commit 6eae71e

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

specification/dartLangSpec.tex

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21387,7 +21387,8 @@ \section{Types}
2138721387
\LMLabel{types}
2138821388

2138921389
\LMHash{}%
21390-
Dart supports optional typing based on interface types.
21390+
Dart supports optional typing based on interface types
21391+
(\ref{interfaceTypes}).
2139121392

2139221393
\rationale{%
2139321394
The type system is unsound, due to the covariance of generic classes.
@@ -22121,8 +22122,7 @@ \subsection{Subtypes}
2212122122
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2212222123
% ------------------------------------------------ Right Object
2212322124
\RuleRaw{\SrnRightObjectFour}{%
22124-
\mbox{$S$ is an interface type,}\\
22125-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22125+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2212622126
% ------------------------------------------------ Left Null 2
2212722127
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2212822128
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22497,8 +22497,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2249722497
\Item{\SrnBottom}{Bottom}
2249822498
\code{Never} is a subtype of every type.
2249922499
\Item{\SrnRightObjectFour}{Right Object}
22500-
Interface types, function types, and \FUNCTION{}
22501-
are subtypes of \code{Object}.
22500+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2250222501
\Item{\SrnNullOne}{Null Nullable}
2250322502
\code{Null} is a subtype of every type of the form \code{$T$?}.
2250422503
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22687,7 +22686,7 @@ \subsection{Type Nullability}
2268722686
\item \code{Never}.
2268822687
\item Any function type.
2268922688
\item The type \FUNCTION.
22690-
\item Any interface type except \code{Null}.
22689+
\item Any interface type.
2269122690
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2269222691
\item Any type variable $X$ whose bound is non-nullable.
2269322692
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24013,8 +24012,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2401324012
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2401424013
\item
2401524014
\DefEquals{\NominalTypeDepth{Object}}{1}.
24016-
\item
24017-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2401824015
\item
2401924016
Let $T$ be a class or a mixin,
2402024017
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24023,10 +24020,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2402324020
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2402424021
\end{itemize}
2402524022

24026-
\commentary{%
24027-
24028-
}
24029-
2403024023
\LMHash{}%
2403124024
\BlindDefineSymbol{I, J, M}%
2403224025
The algorithm that determines
@@ -24415,21 +24408,22 @@ \subsection{Interface Types}
2441524408
(\ref{typedef}).
2441624409
We say that $T$ is an \Index{interface type} if{}f
2441724410
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24418-
where $C$ denotes a class different from \code{Never},
24411+
where $C$ denotes a class different from \code{Never} and \code{Null},
2441924412
or $C$ denotes a mixin.
2442024413

2442124414
\commentary{%
2442224415
Note that \List{T}{1}{k} can be arbitrary types.
2442324416
Non-generic classes are included because we can have $k = 0$.
2442424417

2442524418
In particular, the following types are \emph{not} interface types:
24426-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24419+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24420+
\code{Never}, \code{Null},
2442724421
any function type, any type variable, any intersection type,
2442824422
and any type of the form \code{$T$?}.
2442924423

24430-
Conversely, built-in classes
24431-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24432-
\code{String}, and \code{Exception} are interface types,
24424+
Conversely, built-in classes like
24425+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24426+
are interface types,
2443324427
and so are
2443424428
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2443524429
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)