Skip to content

Commit 6e2ddc0

Browse files
committed
Add missing error: default values must be type correct
1 parent 2ff88c4 commit 6e2ddc0

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

25122512
<defaultNamedParameter> ::= \gnewline{}
25132513
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2514-
\gnewline{} ((`=' | `:') <expression>)?
2514+
\gnewline{} (`:' <expression>)?
25152515
\end{grammar}
25162516

2517-
\LMHash{}%
2518-
The form \syntax{<normalFormalParameter> `:' <expression>}
2519-
is equivalent to the form
2520-
\syntax{<normalFormalParameter> `=' <expression>}.
2521-
The colon-syntax is included only for backwards compatibility.
2522-
It is deprecated and will be removed in
2523-
a later version of the language specification.
2524-
25252517
\LMHash{}%
25262518
It is a \Error{compile-time error} if an optional or named formal parameter has
25272519
the modifier \CONST{} or the modifier \LATE.
@@ -2536,6 +2528,11 @@ \subsubsection{Optional and Named Formals}
25362528
It is a
25372529
\Error{compile-time error} if a required named parameter has a default value.
25382530

2531+
\LMHash{}%
2532+
Assume that $p$ is an optional named parameter with default value $d$.
2533+
It is a \Error{compile-time error}
2534+
if the static type of $d$ is not assignable to the declared type of $p$.
2535+
25392536
\LMHash{}%
25402537
It is a \Error{compile-time error} if the name of a named optional parameter
25412538
begins with an `_' character.

0 commit comments

Comments
 (0)