Skip to content

Commit 2b994c2

Browse files
committed
Interface type fixes
1 parent 00ba195 commit 2b994c2

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
@@ -22191,7 +22191,8 @@ \section{Types}
2219122191
\LMLabel{types}
2219222192

2219322193
\LMHash{}%
22194-
Dart supports static typing based on interface types.
22194+
Dart supports static typing based on interface types
22195+
(\ref{interfaceTypes}).
2219522196

2219622197
\rationale{%
2219722198
The type system is sound in the sense that
@@ -22939,8 +22940,7 @@ \subsection{Subtypes}
2293922940
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2294022941
% ------------------------------------------------ Right Object
2294122942
\RuleRaw{\SrnRightObjectFour}{%
22942-
\mbox{$S$ is an interface type,}\\
22943-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22943+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2294422944
% ------------------------------------------------ Left Null 2
2294522945
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2294622946
\code{Null}}{\code{FutureOr<$T$>}}
@@ -23317,8 +23317,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2331723317
\Item{\SrnBottom}{Bottom}
2331823318
\code{Never} is a subtype of every type.
2331923319
\Item{\SrnRightObjectFour}{Right Object}
23320-
Interface types, function types, and \FUNCTION{}
23321-
are subtypes of \code{Object}.
23320+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2332223321
\Item{\SrnNullOne}{Null Nullable}
2332323322
\code{Null} is a subtype of every type of the form \code{$T$?}.
2332423323
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23507,7 +23506,7 @@ \subsection{Type Nullability}
2350723506
\item \code{Never}.
2350823507
\item Any function type.
2350923508
\item The type \FUNCTION.
23510-
\item Any interface type except \code{Null}.
23509+
\item Any interface type.
2351123510
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2351223511
\item Any type variable $X$ whose bound is non-nullable.
2351323512
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24833,8 +24832,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2483324832
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2483424833
\item
2483524834
\DefEquals{\NominalTypeDepth{Object}}{1}.
24836-
\item
24837-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2483824835
\item
2483924836
Let $T$ be a class or a mixin,
2484024837
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24843,10 +24840,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2484324840
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2484424841
\end{itemize}
2484524842

24846-
\commentary{%
24847-
24848-
}
24849-
2485024843
\LMHash{}%
2485124844
\BlindDefineSymbol{I, J, M}%
2485224845
The algorithm that determines
@@ -25236,21 +25229,22 @@ \subsection{Interface Types}
2523625229
(\ref{typedef}).
2523725230
We say that $T$ is an \Index{interface type} if{}f
2523825231
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
25239-
where $C$ denotes a class different from \code{Never},
25232+
where $C$ denotes a class different from \code{Never} and \code{Null},
2524025233
or $C$ denotes a mixin.
2524125234

2524225235
\commentary{%
2524325236
Note that \List{T}{1}{k} can be arbitrary types.
2524425237
Non-generic classes are included because we can have $k = 0$.
2524525238

2524625239
In particular, the following types are \emph{not} interface types:
25247-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
25240+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
25241+
\code{Never}, \code{Null},
2524825242
any function type, any type variable, any intersection type,
2524925243
and any type of the form \code{$T$?}.
2525025244

25251-
Conversely, built-in classes
25252-
like \code{Object}, \code{Null}, \code{num}, \code{int},
25253-
\code{String}, and \code{Exception} are interface types,
25245+
Conversely, built-in classes like
25246+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
25247+
are interface types,
2525425248
and so are
2525525249
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2525625250
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)