Skip to content

Commit 8ac5b13

Browse files
committed
Interface type fixes
1 parent a14d91a commit 8ac5b13

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
@@ -21324,7 +21324,8 @@ \section{Types}
2132421324
\LMLabel{types}
2132521325

2132621326
\LMHash{}%
21327-
Dart supports optional typing based on interface types.
21327+
Dart supports optional typing based on interface types
21328+
(\ref{interfaceTypes}).
2132821329

2132921330
\rationale{%
2133021331
The type system is unsound, due to the covariance of generic classes.
@@ -22058,8 +22059,7 @@ \subsection{Subtypes}
2205822059
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2205922060
% ------------------------------------------------ Right Object
2206022061
\RuleRaw{\SrnRightObjectFour}{%
22061-
\mbox{$S$ is an interface type,}\\
22062-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22062+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2206322063
% ------------------------------------------------ Left Null 2
2206422064
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2206522065
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22434,8 +22434,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2243422434
\Item{\SrnBottom}{Bottom}
2243522435
\code{Never} is a subtype of every type.
2243622436
\Item{\SrnRightObjectFour}{Right Object}
22437-
Interface types, function types, and \FUNCTION{}
22438-
are subtypes of \code{Object}.
22437+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2243922438
\Item{\SrnNullOne}{Null Nullable}
2244022439
\code{Null} is a subtype of every type of the form \code{$T$?}.
2244122440
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22624,7 +22623,7 @@ \subsection{Type Nullability}
2262422623
\item \code{Never}.
2262522624
\item Any function type.
2262622625
\item The type \FUNCTION.
22627-
\item Any interface type except \code{Null}.
22626+
\item Any interface type.
2262822627
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2262922628
\item Any type variable $X$ whose bound is non-nullable.
2263022629
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -23950,8 +23949,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2395023949
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2395123950
\item
2395223951
\DefEquals{\NominalTypeDepth{Object}}{1}.
23953-
\item
23954-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2395523952
\item
2395623953
Let $T$ be a class or a mixin,
2395723954
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -23960,10 +23957,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2396023957
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2396123958
\end{itemize}
2396223959

23963-
\commentary{%
23964-
23965-
}
23966-
2396723960
\LMHash{}%
2396823961
\BlindDefineSymbol{I, J, M}%
2396923962
The algorithm that determines
@@ -24352,21 +24345,22 @@ \subsection{Interface Types}
2435224345
(\ref{typedef}).
2435324346
We say that $T$ is an \Index{interface type} if{}f
2435424347
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24355-
where $C$ denotes a class different from \code{Never},
24348+
where $C$ denotes a class different from \code{Never} and \code{Null},
2435624349
or $C$ denotes a mixin.
2435724350

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

2436224355
In particular, the following types are \emph{not} interface types:
24363-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24356+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24357+
\code{Never}, \code{Null},
2436424358
any function type, any type variable, any intersection type,
2436524359
and any type of the form \code{$T$?}.
2436624360

24367-
Conversely, built-in classes
24368-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24369-
\code{String}, and \code{Exception} are interface types,
24361+
Conversely, built-in classes like
24362+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24363+
are interface types,
2437024364
and so are
2437124365
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2437224366
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)