Skip to content

Commit 5e00af8

Browse files
committed
Add missing error: default values must be type correct
1 parent eaecbfb commit 5e00af8

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

25252525
<defaultNamedParameter> ::= \gnewline{}
25262526
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2527-
\gnewline{} ((`=' | `:') <expression>)?
2527+
\gnewline{} (`:' <expression>)?
25282528
\end{grammar}
25292529

2530-
\LMHash{}%
2531-
The form \syntax{<normalFormalParameter> `:' <expression>}
2532-
is equivalent to the form
2533-
\syntax{<normalFormalParameter> `=' <expression>}.
2534-
The colon-syntax is included only for backwards compatibility.
2535-
It is deprecated and will be removed in
2536-
a later version of the language specification.
2537-
25382530
\LMHash{}%
25392531
It is a \Error{compile-time error} if an optional or named formal parameter has
25402532
the modifier \CONST{} or the modifier \LATE.
@@ -2549,6 +2541,11 @@ \subsubsection{Optional and Named Formals}
25492541
It is a
25502542
\Error{compile-time error} if a required named parameter has a default value.
25512543

2544+
\LMHash{}%
2545+
Assume that $p$ is an optional named parameter with default value $d$.
2546+
It is a \Error{compile-time error}
2547+
if the static type of $d$ is not assignable to the declared type of $p$.
2548+
25522549
\LMHash{}%
25532550
It is a \Error{compile-time error} if the name of a named optional parameter
25542551
begins with an `_' character.

0 commit comments

Comments
 (0)