Skip to content

Commit ba769d4

Browse files
committed
Add missing error: default values must be type correct
1 parent 64cc7ce commit ba769d4

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
@@ -2515,17 +2515,9 @@ \subsubsection{Optional and Named Formals}
25152515

25162516
<defaultNamedParameter> ::= \gnewline{}
25172517
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2518-
\gnewline{} ((`=' | `:') <expression>)?
2518+
\gnewline{} (`:' <expression>)?
25192519
\end{grammar}
25202520

2521-
\LMHash{}%
2522-
The form \syntax{<normalFormalParameter> `:' <expression>}
2523-
is equivalent to the form
2524-
\syntax{<normalFormalParameter> `=' <expression>}.
2525-
The colon-syntax is included only for backwards compatibility.
2526-
It is deprecated and will be removed in
2527-
a later version of the language specification.
2528-
25292521
\LMHash{}%
25302522
It is a \Error{compile-time error} if an optional or named formal parameter has
25312523
the modifier \CONST{} or the modifier \LATE.
@@ -2540,6 +2532,11 @@ \subsubsection{Optional and Named Formals}
25402532
It is a
25412533
\Error{compile-time error} if a required named parameter has a default value.
25422534

2535+
\LMHash{}%
2536+
Assume that $p$ is an optional named parameter with default value $d$.
2537+
It is a \Error{compile-time error}
2538+
if the static type of $d$ is not assignable to the declared type of $p$.
2539+
25432540
\LMHash{}%
25442541
It is a \Error{compile-time error} if the name of a named optional parameter
25452542
begins with an `_' character.

0 commit comments

Comments
 (0)