Skip to content

Commit 575161b

Browse files
authored
State explicitly that an => body in a constructor is an error (#2064)
The specification does not currently make it explicit that it is an error for a generative constructor to have a body of the form => e;. This PR adds text to make that error explicit.
1 parent bdbef03 commit 575161b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

specification/dartLangSpec.tex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,6 +3578,17 @@ \subsubsection{Generative Constructors}
35783578
introducing a redirection or an initializer list and a body.%
35793579
}
35803580

3581+
%% TODO(eernst): Add `\Error{...}` below when that command is added.
3582+
\LMHash{}%
3583+
A compile-time error occurs if a generative constructor declaration
3584+
has a body of the form `\code{=>\,\,$e$;}'.
3585+
3586+
\commentary{%
3587+
In other function declarations,
3588+
this kind of body is taken to imply that the value of $e$ is returned,
3589+
but generative constructors do not return anything.%
3590+
}
3591+
35813592
\LMHash{}%
35823593
If a formal parameter declaration $p$ is derived from
35833594
\synt{fieldFormalParameter},

0 commit comments

Comments
 (0)