Skip to content

Commit d270bbf

Browse files
committed
Add missing error: default values must be type correct
1 parent 6e270ba commit d270bbf

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

24582458
<defaultNamedParameter> ::= \gnewline{}
24592459
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2460-
\gnewline{} ((`=' | `:') <expression>)?
2460+
\gnewline{} (`:' <expression>)?
24612461
\end{grammar}
24622462

2463-
\LMHash{}%
2464-
The form \syntax{<normalFormalParameter> `:' <expression>}
2465-
is equivalent to the form
2466-
\syntax{<normalFormalParameter> `=' <expression>}.
2467-
The colon-syntax is included only for backwards compatibility.
2468-
It is deprecated and will be removed in
2469-
a later version of the language specification.
2470-
24712463
\LMHash{}%
24722464
It is a \Error{compile-time error} if an optional or named formal parameter has
24732465
the modifier \CONST{} or the modifier \LATE.
@@ -2482,6 +2474,11 @@ \subsubsection{Optional and Named Formals}
24822474
It is a
24832475
\Error{compile-time error} if a required named parameter has a default value.
24842476

2477+
\LMHash{}%
2478+
Assume that $p$ is an optional named parameter with default value $d$.
2479+
It is a \Error{compile-time error}
2480+
if the static type of $d$ is not assignable to the declared type of $p$.
2481+
24852482
\LMHash{}%
24862483
It is a \Error{compile-time error} if the name of a named optional parameter
24872484
begins with an `_' character.

0 commit comments

Comments
 (0)