@@ -2092,7 +2092,7 @@ \section{Functions}
20922092 that the returned object will not be used
20932093 (\ref{return}).%
20942094 }
2095- \item The function is asynchronous, \flatten {T} is not \VOID,
2095+ \item The function is asynchronous, \Flatten {T} is not \VOID,
20962096 and it would have been a compile-time error
20972097 to declare the function with the body
20982098 \code{\ASYNC{} \{ \RETURN{} $e$; \}}
@@ -11879,7 +11879,7 @@ \subsection{Function Expressions}
1187911879 \commentary{%
1188011880 There is no rule for the case where $T$ is of the form \code{$X$\,\&\,$S$}
1188111881 because this will never occur
11882- (this concept is only used in \flattenName , which is defined below).%
11882+ (this concept is only used in \FlattenName , which is defined below).%
1188311883 }
1188411884\end{itemize}
1188511885
@@ -11936,7 +11936,7 @@ \subsection{Function Expressions}
1193611936
1193711937\LMHash{}%
1193811938We define the auxiliary function
11939- \IndexCustom{\flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
11939+ \IndexCustom{\Flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
1194011940as follows, using the first applicable case:
1194111941
1194211942\begin{itemize}
@@ -11946,24 +11946,24 @@ \subsection{Function Expressions}
1194611946
1194711947 \begin{itemize}
1194811948 \item if $S$ derives a future type $U$
11949- then \DefEquals{\flatten {T}}{\code{\flatten {U}}}.
11949+ then \DefEquals{\Flatten {T}}{\code{\Flatten {U}}}.
1195011950 \item otherwise,
11951- \DefEquals{\flatten {T}}{\code{\flatten {X}}}.
11951+ \DefEquals{\Flatten {T}}{\code{\Flatten {X}}}.
1195211952 \end{itemize}
1195311953
1195411954\item If $T$ derives a future type \code{Future<$S$>}
1195511955 or \code{FutureOr<$S$>}
11956- then \DefEquals{\flatten {T}}{S}.
11956+ then \DefEquals{\Flatten {T}}{S}.
1195711957
1195811958\item If $T$ derives a future type \code{Future<$S$>?}\ or
11959- \code{FutureOr<$S$>?}\ then \DefEquals{\flatten {T}}{\code{$S$?}}.
11959+ \code{FutureOr<$S$>?}\ then \DefEquals{\Flatten {T}}{\code{$S$?}}.
1196011960
11961- \item Otherwise, \DefEquals{\flatten {T}}{T}.
11961+ \item Otherwise, \DefEquals{\Flatten {T}}{T}.
1196211962\end{itemize}
1196311963
1196411964\rationale{%
1196511965 This definition guarantees that for any type $T$,
11966- \code{$T <:$ FutureOr<$\flatten {T}$>}. The proof is by induction on the
11966+ \code{$T <:$ FutureOr<$\Flatten {T}$>}. The proof is by induction on the
1196711967 structure of $T$:
1196811968
1196911969 \begin{itemize}
@@ -11972,35 +11972,35 @@ \subsection{Function Expressions}
1197211972 \begin{itemize}
1197311973 \item if $S$ derives a future type $U$,
1197411974 then \code{$T <: S$} and \code{$S <: U$}, so \code{$T <: U$}.
11975- By the induction hypothesis, \code{$U <:$ FutureOr<$\flatten {U}$>}.
11976- Since \code{$\flatten {T} = \flatten {U}$} in this case, it follows that
11977- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11978- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11975+ By the induction hypothesis, \code{$U <:$ FutureOr<$\Flatten {U}$>}.
11976+ Since \code{$\Flatten {T} = \Flatten {U}$} in this case, it follows that
11977+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11978+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1197911979 \item otherwise, \code{$T <: X$}.
11980- By the induction hypothesis, \code{$X <:$ FutureOr<$\flatten {X}$>}.
11981- Since \code{$\flatten {T} = \flatten {X}$} in this case, it follows that
11982- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11983- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11980+ By the induction hypothesis, \code{$X <:$ FutureOr<$\Flatten {X}$>}.
11981+ Since \code{$\Flatten {T} = \Flatten {X}$} in this case, it follows that
11982+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11983+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1198411984 \end{itemize}
1198511985
1198611986 \item If $T$ derives a future type \code{Future<$S$>}
1198711987 or \code{FutureOr<$S$>}, then, since \code{Future<$S$> $<:$ FutureOr<$S$>},
11988- it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\flatten {T} = S$}
11989- in this case, it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11988+ it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\Flatten {T} = S$}
11989+ in this case, it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1199011990
1199111991 \item If $T$ derives a future type \code{Future<$S$>?} or
1199211992 \code{FutureOr<$S$>?}, then, since \code{Future<$S$>? $<:$ FutureOr<$S$>?},
1199311993 it follows that \code{$T <:$ FutureOr<$S$>?}.
1199411994 \code{FutureOr<$S$>? $<:$ FutureOr<$S$?>} for any type $S$
1199511995 (this can be shown using the union type subtype rules and from
1199611996 \code{Future<$S$> $<:$ Future<$S$?>} by covariance), so by transivitity,
11997- \code{$T <:$ FutureOr<$S$?>}. Since \code{$\flatten {T} = S$?} in this case,
11998- it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11997+ \code{$T <:$ FutureOr<$S$?>}. Since \code{$\Flatten {T} = S$?} in this case,
11998+ it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1199911999
12000- \item Otherwise, \code{$\flatten {T} = T$}, so
12001- \code{FutureOr<$\flatten {T}$> $=$ FutureOr<$T$>}. Since
12000+ \item Otherwise, \code{$\Flatten {T} = T$}, so
12001+ \code{FutureOr<$\Flatten {T}$> $=$ FutureOr<$T$>}. Since
1200212002 \code{$T <:$ FutureOr<$T$>}, it follows that
12003- \code{$T <:$ FutureOr<$\flatten {T}$>}.
12003+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1200412004 \end{itemize}
1200512005}
1200612006
@@ -12035,7 +12035,7 @@ \subsection{Function Expressions}
1203512035
1203612036\noindent
1203712037is
12038- \FunctionTypePositionalStdCr{\code{Future<\flatten {T_0}>}},
12038+ \FunctionTypePositionalStdCr{\code{Future<\Flatten {T_0}>}},
1203912039
1204012040\noindent
1204112041where $T_0$ is the static type of $e$.
@@ -12071,7 +12071,7 @@ \subsection{Function Expressions}
1207112071
1207212072\noindent
1207312073is
12074- \FunctionTypeNamedStdCr{\code{Future<\flatten {T_0}>}},
12074+ \FunctionTypeNamedStdCr{\code{Future<\Flatten {T_0}>}},
1207512075
1207612076\noindent
1207712077where $T_0$ is the static type of $e$.
@@ -16887,13 +16887,13 @@ \subsection{Await Expressions}
1688716887\BlindDefineSymbol{a, e, S}%
1688816888Let $a$ be an expression of the form \code{\AWAIT\,\,$e$}.
1688916889Let $S$ be the static type of $e$.
16890- The static type of $a$ is then \flatten {S}
16890+ The static type of $a$ is then \Flatten {S}
1689116891(\ref{functionExpressions}).
1689216892
1689316893\LMHash{}%
1689416894Evaluation of $a$ proceeds as follows:
1689516895First, the expression $e$ is evaluated to an object $o$.
16896- Let \DefineSymbol{T} be \flatten {S}.
16896+ Let \DefineSymbol{T} be \Flatten {S}.
1689716897If the run-time type of $o$ is a subtype of \code{Future<$T$>},
1689816898then let \DefineSymbol{f} be $o$;
1689916899otherwise let $f$ be the result of creating
@@ -16914,7 +16914,7 @@ \subsection{Await Expressions}
1691416914If $f$ completes with an object $v$, $a$ evaluates to $v$.
1691516915
1691616916\rationale{%
16917- The use of \flattenName {} to find $T$
16917+ The use of \FlattenName {} to find $T$
1691816918 and hence determine the dynamic type test
1691916919 implies that we await a future in every case where this choice is sound.%
1692016920}
@@ -16931,7 +16931,7 @@ \subsection{Await Expressions}
1693116931 However, the second kind could be a \code{Future<Object?>}.
1693216932 This object isn't a \code{Future<Object>}, and it isn't \NULL,
1693316933 so it \emph{must} be considered to be in the second group.
16934- Nevertheless, \flatten {\code{FutureOr<Object>?}} is \code{Object?},
16934+ Nevertheless, \Flatten {\code{FutureOr<Object>?}} is \code{Object?},
1693516935 so we \emph{will} await a \code{Future<Object?>}.
1693616936 We have chosen this semantics because it was the smallest breaking change
1693716937 relative to the semantics in earlier versions of Dart,
@@ -19379,7 +19379,7 @@ \subsection{Return}
1937919379%
1938019380% Returning without an object is only ok for async-"voidy" return types.
1938119381It is a compile-time error if $s$ is \code{\RETURN;},
19382- unless \flatten {T}
19382+ unless \Flatten {T}
1938319383(\ref{functionExpressions})
1938419384is \VOID, \DYNAMIC, or \code{Null}.
1938519385%
@@ -19392,26 +19392,26 @@ \subsection{Return}
1939219392% Returning with an object in an void async function only ok
1939319393% when that value is async-"voidy".
1939419394It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19395- \flatten {T} is \VOID,
19396- and \flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
19395+ \Flatten {T} is \VOID,
19396+ and \Flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
1939719397%
1939819398% Returning async-void in a "non-async-voidy" function is an error.
1939919399It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19400- \flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19401- and \flatten {S} is \VOID.
19400+ \Flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19401+ and \Flatten {S} is \VOID.
1940219402%
1940319403% Otherwise, returning an un-deasync-assignable value is an error.
1940419404It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19405- \flatten {S} is not \VOID,
19406- and \code{Future<\flatten {S}>} is not assignable to $T$.
19405+ \Flatten {S} is not \VOID,
19406+ and \code{Future<\Flatten {S}>} is not assignable to $T$.
1940719407
1940819408\commentary{%
19409- Note that \flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
19409+ Note that \Flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
1941019410 in the last case,
1941119411 because then \code{Future<$U$>} is assignable to $T$ for \emph{all} $U$.
1941219412 In particular, when $T$ is \code{FutureOr<Null>}
1941319413 (which is equivalent to \code{Future<Null>}),
19414- \code{Future<\flatten {S}>} is assignable to $T$ for all $S$.
19414+ \code{Future<\Flatten {S}>} is assignable to $T$ for all $S$.
1941519415 This means that no compile-time error is raised,
1941619416 but \emph{only} the null object (\ref{null})
1941719417 or an instance of \code{Future<Null>}
@@ -19423,7 +19423,7 @@ \subsection{Return}
1942319423
1942419424 An error will not be raised if $f$ has no declared return type,
1942519425 since the return type would be \DYNAMIC,
19426- and \code{Future<\flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
19426+ and \code{Future<\Flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
1942719427 However, an asynchronous non-generator function
1942819428 that declares a return type which is not ``voidy''
1942919429 must return an expression explicitly.%
@@ -19474,7 +19474,7 @@ \subsection{Return}
1947419474let $T$ be the actual return type of $f$
1947519475(\ref{actualTypes}).
1947619476If the body of $f$ is marked \ASYNC{} (\ref{functions})
19477- and $S$ is a subtype of \code{Future<\flatten {T}>}
19477+ and $S$ is a subtype of \code{Future<\Flatten {T}>}
1947819478then let $r$ be the result of evaluating \code{await $v$}
1947919479where $v$ is a fresh variable bound to $o$.
1948019480Otherwise let $r$ be $o$.
0 commit comments