Skip to content

Commit f11f2ed

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Fix spec to allow x == null in const expression where x is not num/string/bool/null.
See issue #31140 Bug: http://dartbug.com/31140 Change-Id: I141cc3856a1758313de102084f74f4fa41412586 Reviewed-on: https://dart-review.googlesource.com/15100 Commit-Queue: Lasse R.H. Nielsen <[email protected]> Reviewed-by: Erik Ernst <[email protected]>
1 parent 9f4da5c commit f11f2ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/language/dartLangSpec.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
% - Remove the, now unnecessary, handling of invalid overrides of noSuchMethod.
3131
% - Add >>> as overridable operator.
3232
% - If initializing formal has type annotation, require subtype of field.
33+
% - Constant `==` operations now also allowed if just one operand is null.
3334
%
3435
% 1.15
3536
% - Change how language specification describes control flow.
@@ -2632,7 +2633,7 @@ \subsection{Constants}
26322633
\item A simple or qualified identifier denoting a top-level function (\ref{functions}) or a static method (\ref{staticMethods}) that is not qualified by a deferred prefix.
26332634
\item A parenthesized expression \code{($e$)} where $e$ is a constant expression.
26342635
\item An expression of the form \code{identical($e_1$, $e_2$)} where $e_1$ and $e_2$ are constant expressions and \code{identical()} is statically bound to the predefined dart function \code{identical()} discussed above (\ref{objectIdentity}).
2635-
\item An expression of one of the forms \code{$e_1$ == $e_2$} or \code{$e_1$ != $e_2$} where $e_1$ and $e_2$ are constant expressions that evaluate to a numeric, string or boolean value or to \NULL{}.
2636+
\item An expression of one of the forms \code{$e_1$ == $e_2$} or \code{$e_1$ != $e_2$} where $e_1$ and $e_2$ are constant expressions, and either both evaluate to a numeric, string or boolean value, or at least one of $e_1$ or $e_2$ evaluates to \NULL{}.
26362637
\item An expression of one of the forms \code{!$e$}, \code{$e_1$ \&\& $e_2$} or \code{$e_1 || e_2$}, where $e$, $e_1$ and $e_2$ are constant expressions that evaluate to a boolean value.
26372638
\item An expression of one of the forms \~{}$e$, $e_1$ \^{} $e_2$, \code{$e_1$ \& $e_2$}, $e_1 | e_2$, $e_1 << e_2$, $e_1 >> e_2$ or $e_1 >>> e_2$, where $e$, $e_1$ and $e_2$ are constant expressions that evaluate to an integer value or to \NULL{}.
26382639
\item An expression of the form \code{$e_1 + e_2$} where $e_1$ and $e_2$ are constant expressions that evaluate to a numeric or string value or to \NULL{}.

0 commit comments

Comments
 (0)