Skip to content

Commit 9bebf93

Browse files
committed
Add missing error: default values must be type correct
1 parent 3fb52a3 commit 9bebf93

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

24432443
<defaultNamedParameter> ::= \gnewline{}
24442444
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2445-
\gnewline{} ((`=' | `:') <expression>)?
2445+
\gnewline{} (`:' <expression>)?
24462446
\end{grammar}
24472447

2448-
\LMHash{}%
2449-
The form \syntax{<normalFormalParameter> `:' <expression>}
2450-
is equivalent to the form
2451-
\syntax{<normalFormalParameter> `=' <expression>}.
2452-
The colon-syntax is included only for backwards compatibility.
2453-
It is deprecated and will be removed in
2454-
a later version of the language specification.
2455-
24562448
\LMHash{}%
24572449
It is a \Error{compile-time error} if an optional or named formal parameter has
24582450
the modifier \CONST{} or the modifier \LATE.
@@ -2467,6 +2459,11 @@ \subsubsection{Optional and Named Formals}
24672459
It is a
24682460
\Error{compile-time error} if a required named parameter has a default value.
24692461

2462+
\LMHash{}%
2463+
Assume that $p$ is an optional named parameter with default value $d$.
2464+
It is a \Error{compile-time error}
2465+
if the static type of $d$ is not assignable to the declared type of $p$.
2466+
24702467
\LMHash{}%
24712468
It is a \Error{compile-time error} if the name of a named optional parameter
24722469
begins with an `_' character.

0 commit comments

Comments
 (0)