Skip to content

Commit c28ce82

Browse files
committed
Interface type fixes
1 parent b16af43 commit c28ce82

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
@@ -21763,7 +21763,8 @@ \section{Types}
2176321763
\LMLabel{types}
2176421764

2176521765
\LMHash{}%
21766-
Dart supports static typing based on interface types.
21766+
Dart supports static typing based on interface types
21767+
(\ref{interfaceTypes}).
2176721768

2176821769
\rationale{%
2176921770
The type system is sound in the sense that
@@ -22508,8 +22509,7 @@ \subsection{Subtypes}
2250822509
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2250922510
% ------------------------------------------------ Right Object
2251022511
\RuleRaw{\SrnRightObjectFour}{%
22511-
\mbox{$S$ is an interface type,}\\
22512-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22512+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2251322513
% ------------------------------------------------ Left Null 2
2251422514
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2251522515
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22884,8 +22884,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2288422884
\Item{\SrnBottom}{Bottom}
2288522885
\code{Never} is a subtype of every type.
2288622886
\Item{\SrnRightObjectFour}{Right Object}
22887-
Interface types, function types, and \FUNCTION{}
22888-
are subtypes of \code{Object}.
22887+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2288922888
\Item{\SrnNullOne}{Null Nullable}
2289022889
\code{Null} is a subtype of every type of the form \code{$T$?}.
2289122890
\Item{\SrnNullTwo}{Null FutureOr}
@@ -23074,7 +23073,7 @@ \subsection{Type Nullability}
2307423073
\item \code{Never}.
2307523074
\item Any function type.
2307623075
\item The type \FUNCTION.
23077-
\item Any interface type except \code{Null}.
23076+
\item Any interface type.
2307823077
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2307923078
\item Any type variable $X$ whose bound is non-nullable.
2308023079
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24400,8 +24399,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2440024399
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2440124400
\item
2440224401
\DefEquals{\NominalTypeDepth{Object}}{1}.
24403-
\item
24404-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2440524402
\item
2440624403
Let $T$ be a class or a mixin,
2440724404
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24410,10 +24407,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2441024407
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2441124408
\end{itemize}
2441224409

24413-
\commentary{%
24414-
24415-
}
24416-
2441724410
\LMHash{}%
2441824411
\BlindDefineSymbol{I, J, M}%
2441924412
The algorithm that determines
@@ -24802,21 +24795,22 @@ \subsection{Interface Types}
2480224795
(\ref{typedef}).
2480324796
We say that $T$ is an \Index{interface type} if{}f
2480424797
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24805-
where $C$ denotes a class different from \code{Never},
24798+
where $C$ denotes a class different from \code{Never} and \code{Null},
2480624799
or $C$ denotes a mixin.
2480724800

2480824801
\commentary{%
2480924802
Note that \List{T}{1}{k} can be arbitrary types.
2481024803
Non-generic classes are included because we can have $k = 0$.
2481124804

2481224805
In particular, the following types are \emph{not} interface types:
24813-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24806+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24807+
\code{Never}, \code{Null},
2481424808
any function type, any type variable, any intersection type,
2481524809
and any type of the form \code{$T$?}.
2481624810

24817-
Conversely, built-in classes
24818-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24819-
\code{String}, and \code{Exception} are interface types,
24811+
Conversely, built-in classes like
24812+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24813+
are interface types,
2482024814
and so are
2482124815
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2482224816
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)