@@ -2083,7 +2083,7 @@ \section{Functions}
20832083 that the returned object will not be used
20842084 (\ref{return}).%
20852085 }
2086- \item The function is asynchronous, \flatten {T} is not \VOID,
2086+ \item The function is asynchronous, \Flatten {T} is not \VOID,
20872087 and it would have been a compile-time error
20882088 to declare the function with the body
20892089 \code{\ASYNC{} \{ \RETURN{} $e$; \}}
@@ -11868,7 +11868,7 @@ \subsection{Function Expressions}
1186811868 \commentary{%
1186911869 There is no rule for the case where $T$ is of the form \code{$X$\,\&\,$S$}
1187011870 because this will never occur
11871- (this concept is only used in \flattenName , which is defined below).%
11871+ (this concept is only used in \FlattenName , which is defined below).%
1187211872 }
1187311873\end{itemize}
1187411874
@@ -11925,7 +11925,7 @@ \subsection{Function Expressions}
1192511925
1192611926\LMHash{}%
1192711927We define the auxiliary function
11928- \IndexCustom{\flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
11928+ \IndexCustom{\Flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
1192911929as follows, using the first applicable case:
1193011930
1193111931\begin{itemize}
@@ -11935,24 +11935,24 @@ \subsection{Function Expressions}
1193511935
1193611936 \begin{itemize}
1193711937 \item if $S$ derives a future type $U$
11938- then \DefEquals{\flatten {T}}{\code{\flatten {U}}}.
11938+ then \DefEquals{\Flatten {T}}{\code{\Flatten {U}}}.
1193911939 \item otherwise,
11940- \DefEquals{\flatten {T}}{\code{\flatten {X}}}.
11940+ \DefEquals{\Flatten {T}}{\code{\Flatten {X}}}.
1194111941 \end{itemize}
1194211942
1194311943\item If $T$ derives a future type \code{Future<$S$>}
1194411944 or \code{FutureOr<$S$>}
11945- then \DefEquals{\flatten {T}}{S}.
11945+ then \DefEquals{\Flatten {T}}{S}.
1194611946
1194711947\item If $T$ derives a future type \code{Future<$S$>?}\ or
11948- \code{FutureOr<$S$>?}\ then \DefEquals{\flatten {T}}{\code{$S$?}}.
11948+ \code{FutureOr<$S$>?}\ then \DefEquals{\Flatten {T}}{\code{$S$?}}.
1194911949
11950- \item Otherwise, \DefEquals{\flatten {T}}{T}.
11950+ \item Otherwise, \DefEquals{\Flatten {T}}{T}.
1195111951\end{itemize}
1195211952
1195311953\rationale{%
1195411954 This definition guarantees that for any type $T$,
11955- \code{$T <:$ FutureOr<$\flatten {T}$>}. The proof is by induction on the
11955+ \code{$T <:$ FutureOr<$\Flatten {T}$>}. The proof is by induction on the
1195611956 structure of $T$:
1195711957
1195811958 \begin{itemize}
@@ -11961,35 +11961,35 @@ \subsection{Function Expressions}
1196111961 \begin{itemize}
1196211962 \item if $S$ derives a future type $U$,
1196311963 then \code{$T <: S$} and \code{$S <: U$}, so \code{$T <: U$}.
11964- By the induction hypothesis, \code{$U <:$ FutureOr<$\flatten {U}$>}.
11965- Since \code{$\flatten {T} = \flatten {U}$} in this case, it follows that
11966- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11967- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11964+ By the induction hypothesis, \code{$U <:$ FutureOr<$\Flatten {U}$>}.
11965+ Since \code{$\Flatten {T} = \Flatten {U}$} in this case, it follows that
11966+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11967+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1196811968 \item otherwise, \code{$T <: X$}.
11969- By the induction hypothesis, \code{$X <:$ FutureOr<$\flatten {X}$>}.
11970- Since \code{$\flatten {T} = \flatten {X}$} in this case, it follows that
11971- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11972- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11969+ By the induction hypothesis, \code{$X <:$ FutureOr<$\Flatten {X}$>}.
11970+ Since \code{$\Flatten {T} = \Flatten {X}$} in this case, it follows that
11971+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11972+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1197311973 \end{itemize}
1197411974
1197511975 \item If $T$ derives a future type \code{Future<$S$>}
1197611976 or \code{FutureOr<$S$>}, then, since \code{Future<$S$> $<:$ FutureOr<$S$>},
11977- it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\flatten {T} = S$}
11978- in this case, it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11977+ it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\Flatten {T} = S$}
11978+ in this case, it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1197911979
1198011980 \item If $T$ derives a future type \code{Future<$S$>?} or
1198111981 \code{FutureOr<$S$>?}, then, since \code{Future<$S$>? $<:$ FutureOr<$S$>?},
1198211982 it follows that \code{$T <:$ FutureOr<$S$>?}.
1198311983 \code{FutureOr<$S$>? $<:$ FutureOr<$S$?>} for any type $S$
1198411984 (this can be shown using the union type subtype rules and from
1198511985 \code{Future<$S$> $<:$ Future<$S$?>} by covariance), so by transivitity,
11986- \code{$T <:$ FutureOr<$S$?>}. Since \code{$\flatten {T} = S$?} in this case,
11987- it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11986+ \code{$T <:$ FutureOr<$S$?>}. Since \code{$\Flatten {T} = S$?} in this case,
11987+ it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1198811988
11989- \item Otherwise, \code{$\flatten {T} = T$}, so
11990- \code{FutureOr<$\flatten {T}$> $=$ FutureOr<$T$>}. Since
11989+ \item Otherwise, \code{$\Flatten {T} = T$}, so
11990+ \code{FutureOr<$\Flatten {T}$> $=$ FutureOr<$T$>}. Since
1199111991 \code{$T <:$ FutureOr<$T$>}, it follows that
11992- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11992+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1199311993 \end{itemize}
1199411994}
1199511995
@@ -12024,7 +12024,7 @@ \subsection{Function Expressions}
1202412024
1202512025\noindent
1202612026is
12027- \FunctionTypePositionalStdCr{\code{Future<\flatten {T_0}>}},
12027+ \FunctionTypePositionalStdCr{\code{Future<\Flatten {T_0}>}},
1202812028
1202912029\noindent
1203012030where $T_0$ is the static type of $e$.
@@ -12060,7 +12060,7 @@ \subsection{Function Expressions}
1206012060
1206112061\noindent
1206212062is
12063- \FunctionTypeNamedStdCr{\code{Future<\flatten {T_0}>}},
12063+ \FunctionTypeNamedStdCr{\code{Future<\Flatten {T_0}>}},
1206412064
1206512065\noindent
1206612066where $T_0$ is the static type of $e$.
@@ -16876,13 +16876,13 @@ \subsection{Await Expressions}
1687616876\BlindDefineSymbol{a, e, S}%
1687716877Let $a$ be an expression of the form \code{\AWAIT\,\,$e$}.
1687816878Let $S$ be the static type of $e$.
16879- The static type of $a$ is then \flatten {S}
16879+ The static type of $a$ is then \Flatten {S}
1688016880(\ref{functionExpressions}).
1688116881
1688216882\LMHash{}%
1688316883Evaluation of $a$ proceeds as follows:
1688416884First, the expression $e$ is evaluated to an object $o$.
16885- Let \DefineSymbol{T} be \flatten {S}.
16885+ Let \DefineSymbol{T} be \Flatten {S}.
1688616886If the run-time type of $o$ is a subtype of \code{Future<$T$>},
1688716887then let \DefineSymbol{f} be $o$;
1688816888otherwise let $f$ be the result of creating
@@ -16903,7 +16903,7 @@ \subsection{Await Expressions}
1690316903If $f$ completes with an object $v$, $a$ evaluates to $v$.
1690416904
1690516905\rationale{%
16906- The use of \flattenName {} to find $T$
16906+ The use of \FlattenName {} to find $T$
1690716907 and hence determine the dynamic type test
1690816908 implies that we await a future in every case where this choice is sound.%
1690916909}
@@ -16920,7 +16920,7 @@ \subsection{Await Expressions}
1692016920 However, the second kind could be a \code{Future<Object?>}.
1692116921 This object isn't a \code{Future<Object>}, and it isn't \NULL,
1692216922 so it \emph{must} be considered to be in the second group.
16923- Nevertheless, \flatten {\code{FutureOr<Object>?}} is \code{Object?},
16923+ Nevertheless, \Flatten {\code{FutureOr<Object>?}} is \code{Object?},
1692416924 so we \emph{will} await a \code{Future<Object?>}.
1692516925 We have chosen this semantics because it was the smallest breaking change
1692616926 relative to the semantics in earlier versions of Dart,
@@ -19368,7 +19368,7 @@ \subsection{Return}
1936819368%
1936919369% Returning without an object is only ok for async-"voidy" return types.
1937019370It is a compile-time error if $s$ is \code{\RETURN;},
19371- unless \flatten {T}
19371+ unless \Flatten {T}
1937219372(\ref{functionExpressions})
1937319373is \VOID, \DYNAMIC, or \code{Null}.
1937419374%
@@ -19381,26 +19381,26 @@ \subsection{Return}
1938119381% Returning with an object in an void async function only ok
1938219382% when that value is async-"voidy".
1938319383It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19384- \flatten {T} is \VOID,
19385- and \flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
19384+ \Flatten {T} is \VOID,
19385+ and \Flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
1938619386%
1938719387% Returning async-void in a "non-async-voidy" function is an error.
1938819388It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19389- \flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19390- and \flatten {S} is \VOID.
19389+ \Flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19390+ and \Flatten {S} is \VOID.
1939119391%
1939219392% Otherwise, returning an un-deasync-assignable value is an error.
1939319393It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19394- \flatten {S} is not \VOID,
19395- and \code{Future<\flatten {S}>} is not assignable to $T$.
19394+ \Flatten {S} is not \VOID,
19395+ and \code{Future<\Flatten {S}>} is not assignable to $T$.
1939619396
1939719397\commentary{%
19398- Note that \flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
19398+ Note that \Flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
1939919399 in the last case,
1940019400 because then \code{Future<$U$>} is assignable to $T$ for \emph{all} $U$.
1940119401 In particular, when $T$ is \code{FutureOr<Null>}
1940219402 (which is equivalent to \code{Future<Null>}),
19403- \code{Future<\flatten {S}>} is assignable to $T$ for all $S$.
19403+ \code{Future<\Flatten {S}>} is assignable to $T$ for all $S$.
1940419404 This means that no compile-time error is raised,
1940519405 but \emph{only} the null object (\ref{null})
1940619406 or an instance of \code{Future<Null>}
@@ -19412,7 +19412,7 @@ \subsection{Return}
1941219412
1941319413 An error will not be raised if $f$ has no declared return type,
1941419414 since the return type would be \DYNAMIC,
19415- and \code{Future<\flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
19415+ and \code{Future<\Flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
1941619416 However, an asynchronous non-generator function
1941719417 that declares a return type which is not ``voidy''
1941819418 must return an expression explicitly.%
@@ -19463,7 +19463,7 @@ \subsection{Return}
1946319463let $T$ be the actual return type of $f$
1946419464(\ref{actualTypes}).
1946519465If the body of $f$ is marked \ASYNC{} (\ref{functions})
19466- and $S$ is a subtype of \code{Future<\flatten {T}>}
19466+ and $S$ is a subtype of \code{Future<\Flatten {T}>}
1946719467then let $r$ be the result of evaluating \code{await $v$}
1946819468where $v$ is a fresh variable bound to $o$.
1946919469Otherwise let $r$ be $o$.
0 commit comments