|
41 | 41 | % version of the language which will actually be specified by the next stable
|
42 | 42 | % release of this document.
|
43 | 43 | %
|
| 44 | +% Jun 2024 |
| 45 | +% - Add missing references to section 'Type dynamic' at the points where the |
| 46 | +% static analysis of Object member invocations is specified. |
| 47 | +% |
44 | 48 | % Feb 2024
|
45 | 49 | % - Correct the rule about deriving a future type from a type (which is used
|
46 | 50 | % by `flatten`).
|
@@ -14213,13 +14217,25 @@ \subsubsection{Ordinary Invocation}
|
14213 | 14217 |
|
14214 | 14218 | \LMHash{}%
|
14215 | 14219 | Let $T$ be the static type of $e$.
|
14216 |
| -It is a compile-time error if $T$ does not have an accessible |
| 14220 | + |
| 14221 | +\LMHash{}% |
| 14222 | +If $T$ is \DYNAMIC{} bounded |
| 14223 | +(\ref{bindingActualsToFormals}) |
| 14224 | +and $m$ is one of |
| 14225 | +\code{hashCode}, \code{noSuchMethod}, \code{runtimeType}, or \code{toString} |
| 14226 | +then we say that $i$ is a |
| 14227 | +\IndexCustom{dynamic \code{Object} member invocation}{ |
| 14228 | + dynamic Object member invocation}, |
| 14229 | +whose static analysis is specified separately below. |
| 14230 | + |
| 14231 | +\LMHash{}% |
| 14232 | +Otherwise, it is a compile-time error if $T$ does not have an accessible |
14217 | 14233 | (\ref{privacy})
|
14218 | 14234 | instance member named $m$, unless either:
|
| 14235 | + |
14219 | 14236 | \begin{itemize}
|
14220 | 14237 | \item
|
14221 |
| - $T$ is \DYNAMIC{} bounded |
14222 |
| - (\ref{bindingActualsToFormals}); |
| 14238 | + $T$ is \DYNAMIC{} bounded; |
14223 | 14239 | in this case no further static checks are performed on $i$
|
14224 | 14240 | (\commentary{apart from separate static checks on subterms like arguments})
|
14225 | 14241 | and the static type of $i$ is \DYNAMIC.
|
@@ -14252,7 +14268,22 @@ \subsubsection{Ordinary Invocation}
|
14252 | 14268 | }).
|
14253 | 14269 |
|
14254 | 14270 | \LMHash{}%
|
14255 |
| -Otherwise \code{$T$.$m$} denotes an instance member. |
| 14271 | +If $i$ is a dynamic \code{Object} member invocation |
| 14272 | +(\ref{ordinaryInvocation}) |
| 14273 | +then the static type of the member is specified in |
| 14274 | +Section~\ref{typeDynamic}. |
| 14275 | +In this case, if $m$ is \code{hashCode} or \code{runtimeType} |
| 14276 | +then let $F$ be the return type of said getter; |
| 14277 | +if $m$ is \code{noSuchMethod} or \code{toString} |
| 14278 | +then let $F$ be the type of said method. |
| 14279 | + |
| 14280 | +\commentary{% |
| 14281 | +Note that it is always a compile-time error if $m$ |
| 14282 | +is \code{hashCode} or \code{runtimeType}.% |
| 14283 | +} |
| 14284 | + |
| 14285 | +\LMHash{}% |
| 14286 | +Otherwise, \code{$T$.$m$} denotes an instance member. |
14256 | 14287 | Let $L$ be the library that contains $i$.
|
14257 | 14288 | Let $d$ be the result of method lookup for $m$ in $T$ with respect to $L$,
|
14258 | 14289 | and if the method lookup succeeded then let $F$ be the static type of $d$.
|
@@ -14840,13 +14871,33 @@ \subsubsection{Getter Access and Method Extraction}
|
14840 | 14871 |
|
14841 | 14872 | \LMHash{}%
|
14842 | 14873 | Let $T$ be the static type of $e$.
|
14843 |
| -It is a compile-time error if $T$ does not have a method or getter named \id{} |
14844 |
| -unless $T$ is \DYNAMIC{} bounded |
14845 |
| -(\ref{bindingActualsToFormals}), |
14846 |
| -or $T$ is \FUNCTION{} bounded and \id{} is \CALL. |
| 14874 | + |
| 14875 | +\LMHash{}% |
| 14876 | +If $T$ is \DYNAMIC{} bounded |
| 14877 | +(\ref{bindingActualsToFormals}) |
| 14878 | +and $m$ is one of |
| 14879 | +\code{hashCode}, \code{noSuchMethod}, \code{runtimeType}, or \code{toString} |
| 14880 | +then we say that $i$ is a |
| 14881 | +\IndexCustom{dynamic \code{Object} property extraction}{ |
| 14882 | + dynamic Object property extraction}, |
| 14883 | +whose static analysis is specified separately below. |
| 14884 | + |
| 14885 | +\LMHash{}% |
| 14886 | +Otherwise, it is a compile-time error if $T$ does not have |
| 14887 | +a method or getter named \id{} |
| 14888 | +unless $T$ is \DYNAMIC{} bounded, |
| 14889 | +or $T$ is \FUNCTION{} bounded |
| 14890 | +(\ref{bindingActualsToFormals}) |
| 14891 | +and \id{} is \CALL. |
14847 | 14892 | The static type of $i$ is:
|
14848 | 14893 |
|
14849 | 14894 | \begin{itemize}
|
| 14895 | +\item The return type as specified in Section~\ref{typeDynamic} |
| 14896 | + if $i$ is a dynamic \code{Object} property extraction |
| 14897 | + and \id{} is \code{hashCode} or \code{runtimeType}. |
| 14898 | +\item The static type as specified in Section~\ref{typeDynamic} |
| 14899 | + if $i$ is a dynamic \code{Object} property extraction |
| 14900 | + and \id{} is \code{noSuchMethod} or \code{toString}. |
14850 | 14901 | \item The declared return type of \code{$T$.\id},
|
14851 | 14902 | if $T$ has an accessible instance getter named \id.
|
14852 | 14903 | \item The function type of the method signature \code{$T$.\id},
|
|
0 commit comments