Skip to content

Commit 171d5d4

Browse files
committed
Interface type fixes
1 parent 8d98165 commit 171d5d4

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
@@ -21235,7 +21235,8 @@ \section{Types}
2123521235
\LMLabel{types}
2123621236

2123721237
\LMHash{}%
21238-
Dart supports optional typing based on interface types.
21238+
Dart supports optional typing based on interface types
21239+
(\ref{interfaceTypes}).
2123921240

2124021241
\rationale{%
2124121242
The type system is unsound, due to the covariance of generic classes.
@@ -21969,8 +21970,7 @@ \subsection{Subtypes}
2196921970
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2197021971
% ------------------------------------------------ Right Object
2197121972
\RuleRaw{\SrnRightObjectFour}{%
21972-
\mbox{$S$ is an interface type,}\\
21973-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
21973+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2197421974
% ------------------------------------------------ Left Null 2
2197521975
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2197621976
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22345,8 +22345,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2234522345
\Item{\SrnBottom}{Bottom}
2234622346
\code{Never} is a subtype of every type.
2234722347
\Item{\SrnRightObjectFour}{Right Object}
22348-
Interface types, function types, and \FUNCTION{}
22349-
are subtypes of \code{Object}.
22348+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2235022349
\Item{\SrnNullOne}{Null Nullable}
2235122350
\code{Null} is a subtype of every type of the form \code{$T$?}.
2235222351
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22535,7 +22534,7 @@ \subsection{Type Nullability}
2253522534
\item \code{Never}.
2253622535
\item Any function type.
2253722536
\item The type \FUNCTION.
22538-
\item Any interface type except \code{Null}.
22537+
\item Any interface type.
2253922538
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2254022539
\item Any type variable $X$ whose bound is non-nullable.
2254122540
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23861,8 +23860,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2386123860
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2386223861
\item
2386323862
\DefEquals{\NominalTypeDepth{Object}}{1}.
23864-
\item
23865-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2386623863
\item
2386723864
Let $T$ be a class or a mixin,
2386823865
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23871,10 +23868,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2387123868
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2387223869
\end{itemize}
2387323870

23874-
\commentary{%
23875-
23876-
}
23877-
2387823871
\LMHash{}%
2387923872
\BlindDefineSymbol{I, J, M}%
2388023873
The algorithm that determines
@@ -24263,21 +24256,22 @@ \subsection{Interface Types}
2426324256
(\ref{typedef}).
2426424257
We say that $T$ is an \Index{interface type} if{}f
2426524258
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24266-
where $C$ denotes a class different from \code{Never},
24259+
where $C$ denotes a class different from \code{Never} and \code{Null},
2426724260
or $C$ denotes a mixin.
2426824261

2426924262
\commentary{%
2427024263
Note that \List{T}{1}{k} can be arbitrary types.
2427124264
Non-generic classes are included because we can have $k = 0$.
2427224265

2427324266
In particular, the following types are \emph{not} interface types:
24274-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24267+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24268+
\code{Never}, \code{Null},
2427524269
any function type, any type variable, any intersection type,
2427624270
and any type of the form \code{$T$?}.
2427724271

24278-
Conversely, built-in classes
24279-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24280-
\code{String}, and \code{Exception} are interface types,
24272+
Conversely, built-in classes like
24273+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24274+
are interface types,
2428124275
and so are
2428224276
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2428324277
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)