Skip to content

Commit 12ed4f3

Browse files
committed
Interface type fixes
1 parent 33eba03 commit 12ed4f3

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
@@ -21738,7 +21738,8 @@ \section{Types}
2173821738
\LMLabel{types}
2173921739

2174021740
\LMHash{}%
21741-
Dart supports static typing based on interface types.
21741+
Dart supports static typing based on interface types
21742+
(\ref{interfaceTypes}).
2174221743

2174321744
\rationale{%
2174421745
The type system is sound in the sense that
@@ -22488,8 +22489,7 @@ \subsection{Subtypes}
2248822489
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2248922490
% ------------------------------------------------ Right Object
2249022491
\RuleRaw{\SrnRightObjectFour}{%
22491-
\mbox{$S$ is an interface type,}\\
22492-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22492+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2249322493
% ------------------------------------------------ Left Null 2
2249422494
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2249522495
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22864,8 +22864,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2286422864
\Item{\SrnBottom}{Bottom}
2286522865
\code{Never} is a subtype of every type.
2286622866
\Item{\SrnRightObjectFour}{Right Object}
22867-
Interface types, function types, and \FUNCTION{}
22868-
are subtypes of \code{Object}.
22867+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2286922868
\Item{\SrnNullOne}{Null Nullable}
2287022869
\code{Null} is a subtype of every type of the form \code{$T$?}.
2287122870
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23054,7 +23053,7 @@ \subsection{Type Nullability}
2305423053
\item \code{Never}.
2305523054
\item Any function type.
2305623055
\item The type \FUNCTION.
23057-
\item Any interface type except \code{Null}.
23056+
\item Any interface type.
2305823057
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2305923058
\item Any type variable $X$ whose bound is non-nullable.
2306023059
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24380,8 +24379,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2438024379
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2438124380
\item
2438224381
\DefEquals{\NominalTypeDepth{Object}}{1}.
24383-
\item
24384-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2438524382
\item
2438624383
Let $T$ be a class or a mixin,
2438724384
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24390,10 +24387,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2439024387
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2439124388
\end{itemize}
2439224389

24393-
\commentary{%
24394-
24395-
}
24396-
2439724390
\LMHash{}%
2439824391
\BlindDefineSymbol{I, J, M}%
2439924392
The algorithm that determines
@@ -24782,21 +24775,22 @@ \subsection{Interface Types}
2478224775
(\ref{typedef}).
2478324776
We say that $T$ is an \Index{interface type} if{}f
2478424777
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24785-
where $C$ denotes a class different from \code{Never},
24778+
where $C$ denotes a class different from \code{Never} and \code{Null},
2478624779
or $C$ denotes a mixin.
2478724780

2478824781
\commentary{%
2478924782
Note that \List{T}{1}{k} can be arbitrary types.
2479024783
Non-generic classes are included because we can have $k = 0$.
2479124784

2479224785
In particular, the following types are \emph{not} interface types:
24793-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24786+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24787+
\code{Never}, \code{Null},
2479424788
any function type, any type variable, any intersection type,
2479524789
and any type of the form \code{$T$?}.
2479624790

24797-
Conversely, built-in classes
24798-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24799-
\code{String}, and \code{Exception} are interface types,
24791+
Conversely, built-in classes like
24792+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24793+
are interface types,
2480024794
and so are
2480124795
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2480224796
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)