Skip to content

Commit d6a207f

Browse files
committed
Interface type fixes
1 parent 10b9496 commit d6a207f

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
@@ -21326,7 +21326,8 @@ \section{Types}
2132621326
\LMLabel{types}
2132721327

2132821328
\LMHash{}%
21329-
Dart supports optional typing based on interface types.
21329+
Dart supports optional typing based on interface types
21330+
(\ref{interfaceTypes}).
2133021331

2133121332
\rationale{%
2133221333
The type system is unsound, due to the covariance of generic classes.
@@ -22060,8 +22061,7 @@ \subsection{Subtypes}
2206022061
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2206122062
% ------------------------------------------------ Right Object
2206222063
\RuleRaw{\SrnRightObjectFour}{%
22063-
\mbox{$S$ is an interface type,}\\
22064-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22064+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2206522065
% ------------------------------------------------ Left Null 2
2206622066
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2206722067
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22436,8 +22436,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2243622436
\Item{\SrnBottom}{Bottom}
2243722437
\code{Never} is a subtype of every type.
2243822438
\Item{\SrnRightObjectFour}{Right Object}
22439-
Interface types, function types, and \FUNCTION{}
22440-
are subtypes of \code{Object}.
22439+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2244122440
\Item{\SrnNullOne}{Null Nullable}
2244222441
\code{Null} is a subtype of every type of the form \code{$T$?}.
2244322442
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22626,7 +22625,7 @@ \subsection{Type Nullability}
2262622625
\item \code{Never}.
2262722626
\item Any function type.
2262822627
\item The type \FUNCTION.
22629-
\item Any interface type except \code{Null}.
22628+
\item Any interface type.
2263022629
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2263122630
\item Any type variable $X$ whose bound is non-nullable.
2263222631
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23952,8 +23951,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2395223951
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2395323952
\item
2395423953
\DefEquals{\NominalTypeDepth{Object}}{1}.
23955-
\item
23956-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2395723954
\item
2395823955
Let $T$ be a class or a mixin,
2395923956
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23962,10 +23959,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2396223959
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2396323960
\end{itemize}
2396423961

23965-
\commentary{%
23966-
23967-
}
23968-
2396923962
\LMHash{}%
2397023963
\BlindDefineSymbol{I, J, M}%
2397123964
The algorithm that determines
@@ -24354,21 +24347,22 @@ \subsection{Interface Types}
2435424347
(\ref{typedef}).
2435524348
We say that $T$ is an \Index{interface type} if{}f
2435624349
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24357-
where $C$ denotes a class different from \code{Never},
24350+
where $C$ denotes a class different from \code{Never} and \code{Null},
2435824351
or $C$ denotes a mixin.
2435924352

2436024353
\commentary{%
2436124354
Note that \List{T}{1}{k} can be arbitrary types.
2436224355
Non-generic classes are included because we can have $k = 0$.
2436324356

2436424357
In particular, the following types are \emph{not} interface types:
24365-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24358+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24359+
\code{Never}, \code{Null},
2436624360
any function type, any type variable, any intersection type,
2436724361
and any type of the form \code{$T$?}.
2436824362

24369-
Conversely, built-in classes
24370-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24371-
\code{String}, and \code{Exception} are interface types,
24363+
Conversely, built-in classes like
24364+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24365+
are interface types,
2437224366
and so are
2437324367
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2437424368
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)