Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust definition of flatten #2696

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions specification/dartLangSpec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11268,16 +11268,12 @@ \subsection{Function Expressions}
which is used below and in other sections, as follows:

\begin{itemize}
\item{} If $T$ is a type variable $X$ with bound $B$,
or $T$ is an intersection type
(\ref{intersectionTypes})
\code{$X$\,\,\&\,\,$B$},
then \DefEquals{\flatten{T}}{\flatten{B}}.

\item{} If $T$ is \code{$S$?}\ for some $S$
then \DefEquals{\flatten{T}}{\code{\flatten{S}?}}.

\item{} If $T$ is \code{FutureOr<$S$>} then \DefEquals{\flatten{T}}{S}.
\item{} If $T$ is \code{FutureOr<$S$>} bounded
(\ref{bindingActualsToFormals})
then \DefEquals{\flatten{T}}{S}.

\item{} If $T$ implements \code{Future<$S$>}
(\ref{interfaceSuperinterfaces})
Expand All @@ -11288,7 +11284,13 @@ \subsection{Function Expressions}

\commentary{%
This definition guarantees that for any type $T$,
\code{$T <:$ FutureOr<$\flatten{T}$>}.%
\code{$T <:$ FutureOr<$\flatten{T}$>}.
Note that when $X$ is a type variable with bound $B$,
it is possible that \flatten{X} is different from $X$:
$B$ could, for some $S$, be \code{FutureOr<$S$>},
or a type variable $Y$ with bound \code{FutureOr<$S$>},
or a class $C$ that implements \code{Future<$S$>},
or a type variable $X$ with bound $C$.%
}

\LMHash{}%
Expand Down