Skip to content

Commit 4cd141f

Browse files
committed
Interface type fixes
1 parent 717d123 commit 4cd141f

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
@@ -21453,7 +21453,8 @@ \section{Types}
2145321453
\LMLabel{types}
2145421454

2145521455
\LMHash{}%
21456-
Dart supports optional typing based on interface types.
21456+
Dart supports optional typing based on interface types
21457+
(\ref{interfaceTypes}).
2145721458

2145821459
\rationale{%
2145921460
The type system is unsound, due to the covariance of generic classes.
@@ -22187,8 +22188,7 @@ \subsection{Subtypes}
2218722188
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2218822189
% ------------------------------------------------ Right Object
2218922190
\RuleRaw{\SrnRightObjectFour}{%
22190-
\mbox{$S$ is an interface type,}\\
22191-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22191+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2219222192
% ------------------------------------------------ Left Null 2
2219322193
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2219422194
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22563,8 +22563,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2256322563
\Item{\SrnBottom}{Bottom}
2256422564
\code{Never} is a subtype of every type.
2256522565
\Item{\SrnRightObjectFour}{Right Object}
22566-
Interface types, function types, and \FUNCTION{}
22567-
are subtypes of \code{Object}.
22566+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2256822567
\Item{\SrnNullOne}{Null Nullable}
2256922568
\code{Null} is a subtype of every type of the form \code{$T$?}.
2257022569
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22753,7 +22752,7 @@ \subsection{Type Nullability}
2275322752
\item \code{Never}.
2275422753
\item Any function type.
2275522754
\item The type \FUNCTION.
22756-
\item Any interface type except \code{Null}.
22755+
\item Any interface type.
2275722756
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2275822757
\item Any type variable $X$ whose bound is non-nullable.
2275922758
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24079,8 +24078,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2407924078
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2408024079
\item
2408124080
\DefEquals{\NominalTypeDepth{Object}}{1}.
24082-
\item
24083-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2408424081
\item
2408524082
Let $T$ be a class or a mixin,
2408624083
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24089,10 +24086,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2408924086
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2409024087
\end{itemize}
2409124088

24092-
\commentary{%
24093-
24094-
}
24095-
2409624089
\LMHash{}%
2409724090
\BlindDefineSymbol{I, J, M}%
2409824091
The algorithm that determines
@@ -24481,21 +24474,22 @@ \subsection{Interface Types}
2448124474
(\ref{typedef}).
2448224475
We say that $T$ is an \Index{interface type} if{}f
2448324476
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24484-
where $C$ denotes a class different from \code{Never},
24477+
where $C$ denotes a class different from \code{Never} and \code{Null},
2448524478
or $C$ denotes a mixin.
2448624479

2448724480
\commentary{%
2448824481
Note that \List{T}{1}{k} can be arbitrary types.
2448924482
Non-generic classes are included because we can have $k = 0$.
2449024483

2449124484
In particular, the following types are \emph{not} interface types:
24492-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24485+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24486+
\code{Never}, \code{Null},
2449324487
any function type, any type variable, any intersection type,
2449424488
and any type of the form \code{$T$?}.
2449524489

24496-
Conversely, built-in classes
24497-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24498-
\code{String}, and \code{Exception} are interface types,
24490+
Conversely, built-in classes like
24491+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24492+
are interface types,
2449924493
and so are
2450024494
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2450124495
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)