OLD | NEW |
---|---|
1 \documentclass{article} | 1 \documentclass{article} |
2 \usepackage{epsfig} | 2 \usepackage{epsfig} |
3 \usepackage{color} | 3 \usepackage{color} |
4 \usepackage{dart} | 4 \usepackage{dart} |
5 \usepackage{bnf} | 5 \usepackage{bnf} |
6 \usepackage{hyperref} | 6 \usepackage{hyperref} |
7 \usepackage{lmodern} | 7 \usepackage{lmodern} |
8 \usepackage[T1]{fontenc} | 8 \usepackage[T1]{fontenc} |
9 \newcommand{\code}[1]{{\sf #1}} | 9 \newcommand{\code}[1]{{\sf #1}} |
10 \title{Dart Programming Language Specification \\ | 10 \title{Dart Programming Language Specification \\ |
(...skipping 6435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6446 | 6446 |
6447 \LMHash{} | 6447 \LMHash{} |
6448 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct ion. | 6448 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct ion. |
6449 | 6449 |
6450 \LMHash{} | 6450 \LMHash{} |
6451 It is a static type warning if the body of $f$ is marked \ASYNC{} and the type \ code{Future<flatten(T)>} (\ref{functionExpressions}) may not be assigned to the declared return type of $f$. Otherwise, it is a static type warning if $T$ ma y not be assigned to the declared return type of $f$. | 6451 It is a static type warning if the body of $f$ is marked \ASYNC{} and the type \ code{Future<flatten(T)>} (\ref{functionExpressions}) may not be assigned to the declared return type of $f$. Otherwise, it is a static type warning if $T$ ma y not be assigned to the declared return type of $f$. |
6452 | 6452 |
6453 \LMHash{} | 6453 \LMHash{} |
6454 Let $S$ be the runtime type of $o$. In checked mode: | 6454 Let $S$ be the runtime type of $o$. In checked mode: |
6455 \begin{itemize} | 6455 \begin{itemize} |
6456 \item If the body of $f$ is marked \ASYNC{} (\ref{functions}) it is a dynamic t ype error if $o$ is not \NULL{} (\ref{null}) and \code{Future<flatten(S)>} is no t a subtype of the actual return type (\ref{actualTypeOfADeclaration}) of $f$. | 6456 \item If the body of $f$ is marked \ASYNC{} (\ref{functions}) |
6457 \item Otherwise, it is a dynamic type error if $o$ is not \NULL{} and the runtim e type of $o$ is not a subtype of the actual return type of $f$. | 6457 it is a dynamic type error if $o$ is not \NULL{} (\ref{null}), |
6458 the actual return type (\ref{actualTypeOfADeclaration}) of $f$ is not \VOID, | |
eernst
2017/05/10 14:38:48
At this point we have assumed that (the body of) $
Lasse Reichstein Nielsen
2017/05/11 06:09:59
The change to make `return e;` an error, not just
eernst
2017/05/11 09:56:13
I recommended the comment because I suspect that i
| |
6459 and \code{Future<flatten(S)>} is not a subtype of the actual return type of $f$. | |
6460 \item Otherwise, it is a dynamic type error if $o$ is not \NULL{}, | |
6461 the actual return type of $f$ is not \VOID{}, | |
6462 and the runtime type of $o$ is not a subtype of the actual return type of $f$. | |
6458 \end{itemize} | 6463 \end{itemize} |
6459 | 6464 |
6460 \LMHash{} | 6465 \LMHash{} |
6461 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generative constructor (\ref{generativeConstructors}). | 6466 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generative constructor (\ref{generativeConstructors}). |
6462 | 6467 |
6463 \rationale{ | 6468 \rationale{ |
6464 It is quite easy to forget to add the factory prefix for a constructor, accident ally converting a factory into a generative constructor. The static checker may detect a type mismatch in some, but not all, of these cases. The rule above help s catch such errors, which can otherwise be very hard to recognize. There is no real downside to it, as returning a value from a generative constructor is meani ngless. | 6469 It is quite easy to forget to add the factory prefix for a constructor, accident ally converting a factory into a generative constructor. The static checker may detect a type mismatch in some, but not all, of these cases. The rule above help s catch such errors, which can otherwise be very hard to recognize. There is no real downside to it, as returning a value from a generative constructor is meani ngless. |
6465 } | 6470 } |
6466 | 6471 |
6467 \LMHash{} | 6472 \LMHash{} |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8149 | 8154 |
8150 The invariant that each normative paragraph is associated with a line | 8155 The invariant that each normative paragraph is associated with a line |
8151 containing the text \LMHash{} should be maintained. Extra occurrences | 8156 containing the text \LMHash{} should be maintained. Extra occurrences |
8152 of \LMHash{} can be added if needed, e.g., in order to make | 8157 of \LMHash{} can be added if needed, e.g., in order to make |
8153 individual \item{}s in itemized lists addressable. Each \LM.. command | 8158 individual \item{}s in itemized lists addressable. Each \LM.. command |
8154 must occur on a separate line. \LMHash{} must occur immediately | 8159 must occur on a separate line. \LMHash{} must occur immediately |
8155 before the associated paragraph, and \LMLabel must occur immediately | 8160 before the associated paragraph, and \LMLabel must occur immediately |
8156 after the associated \section{}, \subsection{} etc. | 8161 after the associated \section{}, \subsection{} etc. |
8157 | 8162 |
8158 ---------------------------------------------------------------------- | 8163 ---------------------------------------------------------------------- |
OLD | NEW |