Skip to content

Commit fa6e2b8

Browse files
committed
Add missing error: default values must be type correct
1 parent 2a58fab commit fa6e2b8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

specification/dartLangSpec.tex

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,17 +2462,9 @@ \subsubsection{Optional and Named Formals}
24622462

24632463
<defaultNamedParameter> ::= \gnewline{}
24642464
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2465-
\gnewline{} ((`=' | `:') <expression>)?
2465+
\gnewline{} (`:' <expression>)?
24662466
\end{grammar}
24672467

2468-
\LMHash{}%
2469-
The form \syntax{<normalFormalParameter> `:' <expression>}
2470-
is equivalent to the form
2471-
\syntax{<normalFormalParameter> `=' <expression>}.
2472-
The colon-syntax is included only for backwards compatibility.
2473-
It is deprecated and will be removed in
2474-
a later version of the language specification.
2475-
24762468
\LMHash{}%
24772469
It is a \Error{compile-time error} if an optional or named formal parameter has
24782470
the modifier \CONST{} or the modifier \LATE.
@@ -2487,6 +2479,11 @@ \subsubsection{Optional and Named Formals}
24872479
It is a
24882480
\Error{compile-time error} if a required named parameter has a default value.
24892481

2482+
\LMHash{}%
2483+
Assume that $p$ is an optional named parameter with default value $d$.
2484+
It is a \Error{compile-time error}
2485+
if the static type of $d$ is not assignable to the declared type of $p$.
2486+
24902487
\LMHash{}%
24912488
It is a \Error{compile-time error} if the name of a named optional parameter
24922489
begins with an `_' character.

0 commit comments

Comments
 (0)