4242% - Clarify the conflicts between extension members and `Object` instance
4343% members.
4444% - Correct <partDeclaration> to include metadata.
45+ % - Clarify the section about assignable expressions.
4546%
4647% 2.14
4748% - Add constraint on type of parameter which is covariant-by-declaration in
@@ -5946,7 +5947,7 @@ \subsection{Explicit Invocation of an Instance Member of an Extension}
59465947\IndexCustom{instantiated \ON{} type}{extension!instantiated \ON{} type}
59475948of $a$ as $[T_1/X_1, \ldots, T_s/X_s]T$.
59485949We define the
5949- \IndexCustom{instantiation-to-bound \ON{} type}{
5950+ \IndexCustom{instantiation-to-bound \ON{} type}{%
59505951 extension!instantiation-to-bound \ON{} type}
59515952of $a$ as $[U_1/X_1, \ldots, U_s/X_s]T$,
59525953where \List{U}{1}{s} is the result of instantiation to bound
@@ -6021,7 +6022,7 @@ \subsection{Explicit Invocation of an Instance Member of an Extension}
60216022
60226023\LMHash{}%
60236024The member signature $s_1$ is called the
6024- \IndexCustom{invocation member signature}{
6025+ \IndexCustom{invocation member signature}{%
60256026 extension!invocation member signature}
60266027of $i$.
60276028The static type of $i$ is the return type of
@@ -13371,7 +13372,7 @@ \subsection{Member Invocations}
1337113372expression $r$ is an expression of
1337213373one of the forms shown in Fig.~\ref{fig:memberInvocations}.
1337313374Each member invocation has a
13374- \IndexCustom{corresponding member name}{
13375+ \IndexCustom{corresponding member name}{%
1337513376 member invocation!corresponding member name}
1337613377as shown in the figure.
1337713378
@@ -13712,7 +13713,7 @@ \subsubsection{Ordinary Invocation}
1371213713Otherwise, let $d$ be the result of getter lookup
1371313714for $m$ in $T$ with respect to $L$,
1371413715and let $F$ be the return type of $d$.
13715- (\commentary{
13716+ (\commentary{%
1371613717Since \code{$T$.$m$} exists we cannot have a failure in both lookups.%
1371713718})
1371813719If the getter return type $F$ is an interface type
@@ -13736,7 +13737,7 @@ \subsubsection{Ordinary Invocation}
1373613737\LMHash{}%
1373713738It is a compile-time error to invoke an instance method on a type literal
1373813739that is immediately followed by the token `.' (a period).
13739- \commentary{
13740+ \commentary{%
1374013741For instance, \code{int.toString()} is an error.%
1374113742}
1374213743
@@ -14009,7 +14010,7 @@ \subsubsection{Superinvocations}
1400914010
1401014011\LMHash{}%
1401114012An
14012- \IndexCustom{implicit \CALL{} superinvocation}{
14013+ \IndexCustom{implicit \CALL{} superinvocation}{%
1401314014 method superinvocation!implicit \CALL}
1401414015has the form
1401514016
@@ -16245,18 +16246,27 @@ \subsection{Assignable Expressions}
1624516246\LMLabel{assignableExpressions}
1624616247
1624716248\LMHash{}%
16248- Assignable expressions are expressions
16249+ \IndexCustom{ Assignable expressions}{assignable expression} are terms
1624916250that can appear on the left hand side of an assignment.
16250- This section describes how to evaluate these expressions
16251- when they do not constitute the complete left hand side of an assignment.
16251+ This section describes how to evaluate subterms of these terms when needed.
16252+ The semantics of an assignment as a whole is described elsewhere
16253+ (\ref{assignment}).
1625216254
16253- \rationale{%
16254- Of course, if assignable expressions
16255- always appeared \emph{as} the left hand side,
16256- one would have no need for their value,
16257- and the rules for evaluating them would be unnecessary.
16258- However, assignable expressions can be subexpressions of other expressions
16259- and therefore must be evaluated.%
16255+ \commentary{%
16256+ The grammar of assignable expressions includes very general forms
16257+ like an identifier \id{} or a qualified identifier \code{$\id_1$.$\id_2$}.
16258+ Hence, an assignable expression can have many different meanings,
16259+ depending on the binding of those identifiers in the context.
16260+
16261+ For example, the term \code{x.y.z} is an assignable expression.
16262+ \code{x.y} may refer to a getter \code{y} on
16263+ an object referenced by a variable \code{x},
16264+ in which case \code{x.y} will be evaluated to an object
16265+ before accessing the \code{z} member of that object.
16266+ The term \code{x.y} could also denote a class \code{y} referenced through
16267+ an import prefix \code{x},
16268+ with \code{z} denoting a static variable of that class.
16269+ In this case \code{x.y} will not be evaluated to a value.%
1626016270}
1626116271
1626216272\begin{grammar}
@@ -16276,38 +16286,57 @@ \subsection{Assignable Expressions}
1627616286\end{grammar}
1627716287
1627816288\LMHash{}%
16279- An \Index{assignable expression} is either:
16280- \begin{itemize}
16281- \item An identifier.
16282- \item An invocation (possibly conditional) of a getter (\ref{getters})
16283- or list access operator on an expression $e$.
16284- \item An invocation of a getter or list access operator on \SUPER.
16285- \end{itemize}
16286-
16287- \LMHash{}%
16288- An assignable expression of the form \id{} is evaluated as
16289- an identifier expression (\ref{identifierReference}).
16290-
16291- %An assignable expression of the form \code{$e$.\id($a_1, \ldots,\ a_n$)}
16292- % is evaluated as a method invocation (\ref{methodInvocation}).
16289+ The section about assignments
16290+ (\ref{assignment})
16291+ specifies the static analysis and dynamic semantics of
16292+ various forms of assignment.
16293+ Each of those cases is applicable when the specified subterms satisfy
16294+ the given side conditions
16295+ (\commentary{%
16296+ e.g., one case of the form \code{$e_1$.$v$\,\,??=\,\,$e_2$} requires $e_1$
16297+ to be an expression, whereas \code{$C$.$v$\,\,??=\,\,$e$}
16298+ requires $C$ to be a type literal%
16299+ }).
16300+ The cases requiring subterms to be expressions are considered least specific,
16301+ that is, they are only used if no other case matches
16302+ (\commentary{%
16303+ so the case containing $C$ is used if the corresponding term is a type literal%
16304+ }).
1629316305
16294- \LMHash{}%
16295- An assignable expression of the form \code{$e$.\id} or \code{$e$?.\id}
16296- is evaluated as a property extraction (\ref{propertyExtraction}).
16306+ \commentary{%
16307+ Syntactically, these expressions are not derived from \synt{expression},
16308+ but they are derivable from \synt{expression}, e.g., because
16309+ an \synt{assignableExpression} may contain a \synt{primary}
16310+ which is derivable from \synt{expression}.
16311+ We use the following rule to find such expressions:%
16312+ }
1629716313
1629816314\LMHash{}%
16299- An assignable expression of the form \code{$e_1$[$e_2$]}
16300- is evaluated as a method invocation of
16301- the operator method \code{[]} on $e_1$ with argument $e_2$.
16315+ \BlindDefineSymbol{e, t}%
16316+ Let $e$ be an \synt{assignableExpression}.
16317+ Assume that $t$ is a term such that $e$ can be derived from
16318+ \syntax{$t$ <assignableSelector>}.
16319+ In this case we say that $t$ is the
16320+ \IndexCustom{receiver term}{assignable expression!receiver term}
16321+ of $e$.
16322+ When $t$ is an expression, we say that $t$ is the
16323+ \IndexCustom{receiver expression}{assignable expression!receiver expression}
16324+ of $e$.
1630216325
16303- \LMHash{}%
16304- An assignable expression of the form \code{\SUPER.\id} is evaluated as
16305- a property extraction.
16326+ \commentary{%
16327+ In short, we obtain $t$ by cutting off an assignable selector
16328+ from the end of $e$.
16329+ It is easy to see that only some \synt{assignableExpression}s
16330+ have a receiver term.
16331+ For instance, a plain \synt{identifier} does not.
16332+ %
16333+ }
1630616334
1630716335\LMHash{}%
16308- Evaluation of an assignable expression of the form \code{\SUPER{}[$e_2$]}
16309- is equivalent to
16310- evaluation of the method invocation \code{\SUPER.[]($e_2$)}.
16336+ Let $e$ be an assignable expression.
16337+ Assume that $e$ has a receiver expression $t$.
16338+ Evaluation of $t$ proceeds in the same way as
16339+ evaluation of any other expression.
1631116340
1631216341
1631316342\subsection{Lexical Lookup}
@@ -20331,13 +20360,13 @@ \subsection{Type Aliases}
2033120360it is a compile-time error if $T$ is not regular-bounded,
2033220361and it is a compile-time error if any type occurring in $T$ is not well-bounded.
2033320362
20334- \commentary{
20363+ \commentary{%
2033520364This means that the bounds declared for
2033620365the formal type parameters of a generic type alias
2033720366must be such that when they are satisfied,
2033820367the bounds that pertain to the body are also satisfied,
2033920368and a type occurring as a subterm of the body can violate its bounds,
20340- but only if it is a correct super-bounded type.
20369+ but only if it is a correct super-bounded type.%
2034120370}
2034220371
2034320372\LMHash{}%
@@ -20475,7 +20504,7 @@ \subsection{Type Aliases}
2047520504we say that the parameterized type $U$ of the form
2047620505\code{$F$<\List{U}{1}{s}>}
2047720506in a scope where $F$ resolves to $D$
20478- \IndexCustom{alias expands in one step to}{
20507+ \IndexCustom{alias expands in one step to}{%
2047920508 type alias!alias expands in one step}
2048020509$[U_1/X_1, \ldots, U_s/X_s]T$.
2048120510
@@ -20490,7 +20519,7 @@ \subsection{Type Aliases}
2049020519by its alias expansion in one step
2049120520(\commentary{including the non-generic case where there are no type arguments}).
2049220521When no further steps are possible we say that the resulting type is the
20493- \IndexCustom{transitive alias expansion}{
20522+ \IndexCustom{transitive alias expansion}{%
2049420523 type alias!transitive alias expansion}
2049520524of $U$.
2049620525
@@ -20762,7 +20791,7 @@ \subsection{Subtypes}
2076220791 \begin{minipage}[c]{0.49\textwidth}
2076320792 \RuleTwo{\SrnLeftFutureOr}{Left FutureOr}{S}{T}{%
2076420793 \code{Future<$S$>}}{T}{\code{FutureOr<$S$>}}{T}
20765- \RuleTwo{\SrnRightPromotedVariable}{Right Promoted Variable}{S}{X}{S}{T}{
20794+ \RuleTwo{\SrnRightPromotedVariable}{Right Promoted Variable}{S}{X}{S}{T}{%
2076620795 S}{X \& T}
2076720796 \Rule{\SrnRightFutureOrB}{Right FutureOr B}{S}{T}{S}{\code{FutureOr<$T$>}}
2076820797 \Rule{\SrnLeftVariableBound}{Left Variable Bound}{\Gamma(X)}{T}{X}{T}
@@ -20772,7 +20801,7 @@ \subsection{Subtypes}
2077220801 \Rule{\SrnRightFutureOrA}{Right FutureOr A}{S}{\code{Future<$T$>}}{%
2077320802 S}{\code{FutureOr<$T$>}}
2077420803 \Rule{\SrnLeftPromotedVariable}{Left Promoted Variable B}{S}{T}{X \& S}{T}
20775- \RuleRaw{\SrnRightFunction}{Right Function}{T\mbox{ is a function type}}{
20804+ \RuleRaw{\SrnRightFunction}{Right Function}{T\mbox{ is a function type}}{%
2077620805 T}{\FUNCTION}
2077720806 \end{minipage}
2077820807 %
@@ -20788,7 +20817,7 @@ \subsection{Subtypes}
2078820817 \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
2078920818 \end{array}}
2079020819 \ExtraVSP\ExtraVSP
20791- \RuleRawRaw{\SrnNamedFunctionType}{Named Function Types}{
20820+ \RuleRawRaw{\SrnNamedFunctionType}{Named Function Types}{%
2079220821 \Gamma' = \Gamma\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
2079320822 \Subtype{\Gamma'}{S_0}{T_0} &
2079420823 \forall j \in 1 .. n\!:\;\Subtype{\Gamma'}{T_j}{S_j} \\
0 commit comments