Skip to content

Commit 8e2d56b

Browse files
committed
Interface type fixes
1 parent 73b5e6e commit 8e2d56b

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
@@ -21575,7 +21575,8 @@ \section{Types}
2157521575
\LMLabel{types}
2157621576

2157721577
\LMHash{}%
21578-
Dart supports static typing based on interface types.
21578+
Dart supports static typing based on interface types
21579+
(\ref{interfaceTypes}).
2157921580

2158021581
\rationale{%
2158121582
The type system is sound in the sense that
@@ -22325,8 +22326,7 @@ \subsection{Subtypes}
2232522326
T \in \{\code{Object?}, \DYNAMIC, \VOID\}}{S}{T}
2232622327
% ------------------------------------------------ Right Object
2232722328
\RuleRaw{\SrnRightObjectFour}{%
22328-
\mbox{$S$ is an interface type,}\\
22329-
\mbox{a function type, or \FUNCTION}}{S}{\code{Object}}
22329+
\mbox{$S$ is an interface type or \FUNCTION}}{S}{\code{Object}}
2233022330
% ------------------------------------------------ Left Null 2
2233122331
\Rule{\SrnNullTwo}{\code{Null}}{T}{%
2233222332
\code{Null}}{\code{FutureOr<$T$>}}
@@ -22701,8 +22701,7 @@ \subsubsection{Informal Subtype Rule Descriptions}
2270122701
\Item{\SrnBottom}{Bottom}
2270222702
\code{Never} is a subtype of every type.
2270322703
\Item{\SrnRightObjectFour}{Right Object}
22704-
Interface types, function types, and \FUNCTION{}
22705-
are subtypes of \code{Object}.
22704+
Interface types and \FUNCTION{} are subtypes of \code{Object}.
2270622705
\Item{\SrnNullOne}{Null Nullable}
2270722706
\code{Null} is a subtype of every type of the form \code{$T$?}.
2270822707
\Item{\SrnNullTwo}{Null FutureOr}
@@ -22891,7 +22890,7 @@ \subsection{Type Nullability}
2289122890
\item \code{Never}.
2289222891
\item Any function type.
2289322892
\item The type \FUNCTION.
22894-
\item Any interface type except \code{Null}.
22893+
\item Any interface type.
2289522894
\item \code{FutureOr<$S$>}, for any non-nullable type $S$.
2289622895
\item Any type variable $X$ whose bound is non-nullable.
2289722896
\item Any type of the form \code{$X$\,\&\,$S$}, where
@@ -24217,8 +24216,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2421724216
\DefEquals{\NominalTypeDepth{Object?}}{0}.
2421824217
\item
2421924218
\DefEquals{\NominalTypeDepth{Object}}{1}.
24220-
\item
24221-
\DefEquals{\NominalTypeDepth{Null}}{1}.
2422224219
\item
2422324220
Let $T$ be a class or a mixin,
2422424221
and let $M$ be the set of immediate superinterfaces of $T$.
@@ -24227,10 +24224,6 @@ \subsubsection{The Standard Upper Bound of Distinct Interface Types}
2422724224
$\metavar{max}\,\{\;\NominalTypeDepth{$S$}\;|\;S\;\in M\;\}$.
2422824225
\end{itemize}
2422924226

24230-
\commentary{%
24231-
24232-
}
24233-
2423424227
\LMHash{}%
2423524228
\BlindDefineSymbol{I, J, M}%
2423624229
The algorithm that determines
@@ -24619,21 +24612,22 @@ \subsection{Interface Types}
2461924612
(\ref{typedef}).
2462024613
We say that $T$ is an \Index{interface type} if{}f
2462124614
$T'$ is of the form \code{$C$<\List{T}{1}{k}>},
24622-
where $C$ denotes a class different from \code{Never},
24615+
where $C$ denotes a class different from \code{Never} and \code{Null},
2462324616
or $C$ denotes a mixin.
2462424617

2462524618
\commentary{%
2462624619
Note that \List{T}{1}{k} can be arbitrary types.
2462724620
Non-generic classes are included because we can have $k = 0$.
2462824621

2462924622
In particular, the following types are \emph{not} interface types:
24630-
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$, \code{Never},
24623+
\VOID, \DYNAMIC, \FUNCTION, \code{FutureOr<$T$>} for any $T$,
24624+
\code{Never}, \code{Null},
2463124625
any function type, any type variable, any intersection type,
2463224626
and any type of the form \code{$T$?}.
2463324627

24634-
Conversely, built-in classes
24635-
like \code{Object}, \code{Null}, \code{num}, \code{int},
24636-
\code{String}, and \code{Exception} are interface types,
24628+
Conversely, built-in classes like
24629+
\code{Object}, \code{num}, \code{int}, \code{String}, and \code{Exception}
24630+
are interface types,
2463724631
and so are
2463824632
\code{Future<$T$>}, \code{Stream<$T$>}, \code{Iterable<$T$>},
2463924633
\code{List<$T$>}, \code{Map<$S$,\,\,$T$}, and \code{Set<$T$>},

0 commit comments

Comments
 (0)