@@ -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$; \}}
@@ -11856,7 +11856,7 @@ \subsection{Function Expressions}
1185611856 \commentary{%
1185711857 There is no rule for the case where $T$ is of the form \code{$X$\,\&\,$S$}
1185811858 because this will never occur
11859- (this concept is only used in \flattenName , which is defined below).%
11859+ (this concept is only used in \FlattenName , which is defined below).%
1186011860 }
1186111861\end{itemize}
1186211862
@@ -11913,7 +11913,7 @@ \subsection{Function Expressions}
1191311913
1191411914\LMHash{}%
1191511915We define the auxiliary function
11916- \IndexCustom{\flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
11916+ \IndexCustom{\Flatten {T}}{flatten(t)@\emph{flatten}$(T)$}
1191711917as follows, using the first applicable case:
1191811918
1191911919\begin{itemize}
@@ -11923,24 +11923,24 @@ \subsection{Function Expressions}
1192311923
1192411924 \begin{itemize}
1192511925 \item if $S$ derives a future type $U$
11926- then \DefEquals{\flatten {T}}{\code{\flatten {U}}}.
11926+ then \DefEquals{\Flatten {T}}{\code{\Flatten {U}}}.
1192711927 \item otherwise,
11928- \DefEquals{\flatten {T}}{\code{\flatten {X}}}.
11928+ \DefEquals{\Flatten {T}}{\code{\Flatten {X}}}.
1192911929 \end{itemize}
1193011930
1193111931\item If $T$ derives a future type \code{Future<$S$>}
1193211932 or \code{FutureOr<$S$>}
11933- then \DefEquals{\flatten {T}}{S}.
11933+ then \DefEquals{\Flatten {T}}{S}.
1193411934
1193511935\item If $T$ derives a future type \code{Future<$S$>?}\ or
11936- \code{FutureOr<$S$>?}\ then \DefEquals{\flatten {T}}{\code{$S$?}}.
11936+ \code{FutureOr<$S$>?}\ then \DefEquals{\Flatten {T}}{\code{$S$?}}.
1193711937
11938- \item Otherwise, \DefEquals{\flatten {T}}{T}.
11938+ \item Otherwise, \DefEquals{\Flatten {T}}{T}.
1193911939\end{itemize}
1194011940
1194111941\rationale{%
1194211942 This definition guarantees that for any type $T$,
11943- \code{$T <:$ FutureOr<$\flatten {T}$>}. The proof is by induction on the
11943+ \code{$T <:$ FutureOr<$\Flatten {T}$>}. The proof is by induction on the
1194411944 structure of $T$:
1194511945
1194611946 \begin{itemize}
@@ -11949,35 +11949,35 @@ \subsection{Function Expressions}
1194911949 \begin{itemize}
1195011950 \item if $S$ derives a future type $U$,
1195111951 then \code{$T <: S$} and \code{$S <: U$}, so \code{$T <: U$}.
11952- By the induction hypothesis, \code{$U <:$ FutureOr<$\flatten {U}$>}.
11953- Since \code{$\flatten {T} = \flatten {U}$} in this case, it follows that
11954- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11955- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11952+ By the induction hypothesis, \code{$U <:$ FutureOr<$\Flatten {U}$>}.
11953+ Since \code{$\Flatten {T} = \Flatten {U}$} in this case, it follows that
11954+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11955+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1195611956 \item otherwise, \code{$T <: X$}.
11957- By the induction hypothesis, \code{$X <:$ FutureOr<$\flatten {X}$>}.
11958- Since \code{$\flatten {T} = \flatten {X}$} in this case, it follows that
11959- \code{$U <:$ FutureOr<$\flatten {T}$>}, and so
11960- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11957+ By the induction hypothesis, \code{$X <:$ FutureOr<$\Flatten {X}$>}.
11958+ Since \code{$\Flatten {T} = \Flatten {X}$} in this case, it follows that
11959+ \code{$U <:$ FutureOr<$\Flatten {T}$>}, and so
11960+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1196111961 \end{itemize}
1196211962
1196311963 \item If $T$ derives a future type \code{Future<$S$>}
1196411964 or \code{FutureOr<$S$>}, then, since \code{Future<$S$> $<:$ FutureOr<$S$>},
11965- it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\flatten {T} = S$}
11966- in this case, it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11965+ it follows that \code{$T <:$ FutureOr<$S$>}. Since \code{$\Flatten {T} = S$}
11966+ in this case, it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1196711967
1196811968 \item If $T$ derives a future type \code{Future<$S$>?} or
1196911969 \code{FutureOr<$S$>?}, then, since \code{Future<$S$>? $<:$ FutureOr<$S$>?},
1197011970 it follows that \code{$T <:$ FutureOr<$S$>?}.
1197111971 \code{FutureOr<$S$>? $<:$ FutureOr<$S$?>} for any type $S$
1197211972 (this can be shown using the union type subtype rules and from
1197311973 \code{Future<$S$> $<:$ Future<$S$?>} by covariance), so by transivitity,
11974- \code{$T <:$ FutureOr<$S$?>}. Since \code{$\flatten {T} = S$?} in this case,
11975- it follows that \code{$T <:$ FutureOr<$\flatten {T}$>}.
11974+ \code{$T <:$ FutureOr<$S$?>}. Since \code{$\Flatten {T} = S$?} in this case,
11975+ it follows that \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1197611976
11977- \item Otherwise, \code{$\flatten {T} = T$}, so
11978- \code{FutureOr<$\flatten {T}$> $=$ FutureOr<$T$>}. Since
11977+ \item Otherwise, \code{$\Flatten {T} = T$}, so
11978+ \code{FutureOr<$\Flatten {T}$> $=$ FutureOr<$T$>}. Since
1197911979 \code{$T <:$ FutureOr<$T$>}, it follows that
11980- \code{$T <:$ FutureOr<$\flatten {T}$>}.
11980+ \code{$T <:$ FutureOr<$\Flatten {T}$>}.
1198111981 \end{itemize}
1198211982}
1198311983
@@ -12012,7 +12012,7 @@ \subsection{Function Expressions}
1201212012
1201312013\noindent
1201412014is
12015- \FunctionTypePositionalStdCr{\code{Future<\flatten {T_0}>}},
12015+ \FunctionTypePositionalStdCr{\code{Future<\Flatten {T_0}>}},
1201612016
1201712017\noindent
1201812018where $T_0$ is the static type of $e$.
@@ -12048,7 +12048,7 @@ \subsection{Function Expressions}
1204812048
1204912049\noindent
1205012050is
12051- \FunctionTypeNamedStdCr{\code{Future<\flatten {T_0}>}},
12051+ \FunctionTypeNamedStdCr{\code{Future<\Flatten {T_0}>}},
1205212052
1205312053\noindent
1205412054where $T_0$ is the static type of $e$.
@@ -16864,13 +16864,13 @@ \subsection{Await Expressions}
1686416864\BlindDefineSymbol{a, e, S}%
1686516865Let $a$ be an expression of the form \code{\AWAIT\,\,$e$}.
1686616866Let $S$ be the static type of $e$.
16867- The static type of $a$ is then \flatten {S}
16867+ The static type of $a$ is then \Flatten {S}
1686816868(\ref{functionExpressions}).
1686916869
1687016870\LMHash{}%
1687116871Evaluation of $a$ proceeds as follows:
1687216872First, the expression $e$ is evaluated to an object $o$.
16873- Let \DefineSymbol{T} be \flatten {S}.
16873+ Let \DefineSymbol{T} be \Flatten {S}.
1687416874If the run-time type of $o$ is a subtype of \code{Future<$T$>},
1687516875then let \DefineSymbol{f} be $o$;
1687616876otherwise let $f$ be the result of creating
@@ -16891,7 +16891,7 @@ \subsection{Await Expressions}
1689116891If $f$ completes with an object $v$, $a$ evaluates to $v$.
1689216892
1689316893\rationale{%
16894- The use of \flattenName {} to find $T$
16894+ The use of \FlattenName {} to find $T$
1689516895 and hence determine the dynamic type test
1689616896 implies that we await a future in every case where this choice is sound.%
1689716897}
@@ -16908,7 +16908,7 @@ \subsection{Await Expressions}
1690816908 However, the second kind could be a \code{Future<Object?>}.
1690916909 This object isn't a \code{Future<Object>}, and it isn't \NULL,
1691016910 so it \emph{must} be considered to be in the second group.
16911- Nevertheless, \flatten {\code{FutureOr<Object>?}} is \code{Object?},
16911+ Nevertheless, \Flatten {\code{FutureOr<Object>?}} is \code{Object?},
1691216912 so we \emph{will} await a \code{Future<Object?>}.
1691316913 We have chosen this semantics because it was the smallest breaking change
1691416914 relative to the semantics in earlier versions of Dart,
@@ -19356,7 +19356,7 @@ \subsection{Return}
1935619356%
1935719357% Returning without an object is only ok for async-"voidy" return types.
1935819358It is a compile-time error if $s$ is \code{\RETURN;},
19359- unless \flatten {T}
19359+ unless \Flatten {T}
1936019360(\ref{functionExpressions})
1936119361is \VOID, \DYNAMIC, or \code{Null}.
1936219362%
@@ -19369,26 +19369,26 @@ \subsection{Return}
1936919369% Returning with an object in an void async function only ok
1937019370% when that value is async-"voidy".
1937119371It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19372- \flatten {T} is \VOID,
19373- and \flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
19372+ \Flatten {T} is \VOID,
19373+ and \Flatten {S} is neither \VOID, \DYNAMIC, nor \code{Null}.
1937419374%
1937519375% Returning async-void in a "non-async-voidy" function is an error.
1937619376It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19377- \flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19378- and \flatten {S} is \VOID.
19377+ \Flatten {T} is neither \VOID, \DYNAMIC, nor \code{Null},
19378+ and \Flatten {S} is \VOID.
1937919379%
1938019380% Otherwise, returning an un-deasync-assignable value is an error.
1938119381It is a compile-time error if $s$ is \code{\RETURN{} $e$;},
19382- \flatten {S} is not \VOID,
19383- and \code{Future<\flatten {S}>} is not assignable to $T$.
19382+ \Flatten {S} is not \VOID,
19383+ and \code{Future<\Flatten {S}>} is not assignable to $T$.
1938419384
1938519385\commentary{%
19386- Note that \flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
19386+ Note that \Flatten {T} cannot be \VOID, \DYNAMIC, or \code{Null}
1938719387 in the last case,
1938819388 because then \code{Future<$U$>} is assignable to $T$ for \emph{all} $U$.
1938919389 In particular, when $T$ is \code{FutureOr<Null>}
1939019390 (which is equivalent to \code{Future<Null>}),
19391- \code{Future<\flatten {S}>} is assignable to $T$ for all $S$.
19391+ \code{Future<\Flatten {S}>} is assignable to $T$ for all $S$.
1939219392 This means that no compile-time error is raised,
1939319393 but \emph{only} the null object (\ref{null})
1939419394 or an instance of \code{Future<Null>}
@@ -19400,7 +19400,7 @@ \subsection{Return}
1940019400
1940119401 An error will not be raised if $f$ has no declared return type,
1940219402 since the return type would be \DYNAMIC,
19403- and \code{Future<\flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
19403+ and \code{Future<\Flatten {S}>} is assignable to \DYNAMIC{} for all $S$.
1940419404 However, an asynchronous non-generator function
1940519405 that declares a return type which is not ``voidy''
1940619406 must return an expression explicitly.%
@@ -19451,7 +19451,7 @@ \subsection{Return}
1945119451let $T$ be the actual return type of $f$
1945219452(\ref{actualTypes}).
1945319453If the body of $f$ is marked \ASYNC{} (\ref{functions})
19454- and $S$ is a subtype of \code{Future<\flatten {T}>}
19454+ and $S$ is a subtype of \code{Future<\Flatten {T}>}
1945519455then let $r$ be the result of evaluating \code{await $v$}
1945619456where $v$ is a fresh variable bound to $o$.
1945719457Otherwise let $r$ be $o$.
0 commit comments