Skip to content

Commit 70106d2

Browse files
authored
Add s?.length as a constant expression (#4385)
1 parent da126ec commit 70106d2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

specification/dartLangSpec.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
% version of the language which will actually be specified by the next stable
4242
% release of this document.
4343
%
44+
% May 2025
45+
% - Add `s?.length` as a constant expression in the case where `s` satisfies
46+
% some requirements.
47+
%
4448
% Apr 2025
4549
% - Change the rules about constants to be more consistent: Every constant
4650
% expression is also a potentially constant expression. Also, eliminate
@@ -8872,6 +8876,12 @@ \subsection{Constants}
88728876
evaluates to an instance of \code{String},
88738877
such that \code{length} denotes an instance getter invocation.
88748878

8879+
\item An expression of the form \code{$e$?.length} is potentially constant
8880+
if $e$ is a potentially constant expression.
8881+
It is further constant if $e$ is a constant expression that
8882+
evaluates to null, or it evaluates to an instance of \code{String}
8883+
and \code{length} denotes an instance getter invocation.
8884+
88758885
\item An expression of the form \code{$e$\,\,as\,\,$T$} is potentially constant
88768886
if $e$ is a potentially constant expression
88778887
and $T$ is a constant type expression,

0 commit comments

Comments
 (0)