Skip to content

Commit 5beba67

Browse files
committed
Add missing error: default values must be type correct
1 parent 9042a78 commit 5beba67

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

22892289
<defaultNamedParameter> ::= \gnewline{}
22902290
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2291-
\gnewline{} ((`=' | `:') <expression>)?
2291+
\gnewline{} (`:' <expression>)?
22922292
\end{grammar}
22932293

2294-
\LMHash{}%
2295-
The form \syntax{<normalFormalParameter> `:' <expression>}
2296-
is equivalent to the form
2297-
\syntax{<normalFormalParameter> `=' <expression>}.
2298-
The colon-syntax is included only for backwards compatibility.
2299-
It is deprecated and will be removed in
2300-
a later version of the language specification.
2301-
23022294
\LMHash{}%
23032295
It is a \Error{compile-time error} if an optional or named formal parameter has
23042296
the modifier \CONST{} or the modifier \LATE.
@@ -2313,6 +2305,11 @@ \subsubsection{Optional and Named Formals}
23132305
It is a
23142306
\Error{compile-time error} if a required named parameter has a default value.
23152307

2308+
\LMHash{}%
2309+
Assume that $p$ is an optional named parameter with default value $d$.
2310+
It is a \Error{compile-time error}
2311+
if the static type of $d$ is not assignable to the declared type of $p$.
2312+
23162313
\LMHash{}%
23172314
It is a \Error{compile-time error} if the name of a named optional parameter
23182315
begins with an `_' character.

0 commit comments

Comments
 (0)