Skip to content

Specify null safety #2605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 91 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
47d258d
Rebasing
eernstg Oct 7, 2021
d29d819
Typos: Escaping braces meant to be code
eernstg Oct 8, 2021
60fb793
Eliminated text about migration features, adapted the remaining text …
eernstg Oct 8, 2021
d3fc4b7
Rebasing
eernstg Oct 13, 2021
bb72671
Reorganized material on null/Null
eernstg Oct 14, 2021
7802c95
Rebase
eernstg Oct 18, 2021
b3099d0
Rebasing
eernstg Oct 27, 2021
945bb91
Rebase
eernstg Nov 1, 2021
2a5c83f
WIP
eernstg Nov 9, 2021
83ee82c
Corrected last part of section Variables
eernstg Nov 10, 2021
fba8c03
Did expression typing, spread element, i2b
eernstg Nov 11, 2021
7473da8
Super-bounded types, least and greatest closure
eernstg Nov 12, 2021
46b016a
Assignability, generics
eernstg Nov 12, 2021
67f8b25
Extreme types
eernstg Nov 12, 2021
5cefc95
Extreme types, helper functions
eernstg Nov 15, 2021
15af632
Rebase
eernstg Nov 16, 2021
6efbaef
.call insertion on nullable type; clean up BlindDefineSymbol
eernstg Nov 16, 2021
2c4267f
Rebase
eernstg Nov 16, 2021
aeee68c
Main
eernstg Nov 16, 2021
fae8332
Type Type
eernstg Nov 17, 2021
9584c35
Type Type fixes
eernstg Nov 17, 2021
868779f
More typeType fixes
eernstg Nov 17, 2021
f24ba03
Constant instances (in particular: about canonical instances)
eernstg Nov 18, 2021
074c06f
Corrected variable initialization specification ("has been stored" ra…
eernstg Nov 19, 2021
dc253e2
Small adjustments to Variables
eernstg Nov 19, 2021
4232772
Rebase
eernstg Nov 26, 2021
537b374
Boolean conversion; type test; made true/false terminology consistent…
eernstg Nov 29, 2021
3b2b2d4
Constant types; type variable elimination in constants
eernstg Nov 29, 2021
b377646
Conditional expression; operators && and ||; `if` statements; delete …
eernstg Nov 30, 2021
50dea12
Integrate Null Promotion; put v==null rules into Type Promotion, and …
eernstg Dec 1, 2021
1d4a847
Null shorting
eernstg Dec 1, 2021
401df8c
Small fixes in section Null Shorting
eernstg Dec 1, 2021
39c5475
Revisiting all occurrences of \NULL/Null/null
eernstg Dec 2, 2021
22a0c29
Did much of Standard ... Bounds
eernstg Dec 3, 2021
63700ea
Standard bounds
eernstg Dec 7, 2021
f1ac643
Fixed the "SUB issues" section
eernstg Dec 8, 2021
2a0537d
Rebase
eernstg Dec 8, 2021
c55f1e3
Rebase
eernstg Dec 8, 2021
f108211
Rebase
eernstg Dec 8, 2021
a9ca79e
Rebase
eernstg Dec 9, 2021
943d030
Rebase
eernstg Dec 10, 2021
7738f83
Clarified and corrected Canonical Syntax
eernstg Dec 10, 2021
433b0f3
Fixed subsubsection --> subsection, 2*
eernstg Dec 10, 2021
793bf72
Typos
eernstg Jan 5, 2022
236bd75
Whitespace
eernstg Jan 6, 2022
322ffea
Interface type fixes
eernstg Jan 6, 2022
18fecb7
Sync with specify_null_safety_new_sections_dec21
eernstg Jan 7, 2022
cbfbe93
Mark a subtype rule as redundant, in a TODO comment
eernstg Jan 7, 2022
0ec3d04
Adjust no-loops-in-noSuchMethod example
eernstg Feb 7, 2022
1a8d490
Adjust no-loops-in-noSuchMethod example
eernstg Feb 8, 2022
cc984e9
Corrected function type subtype rule (bounds); corrected "math" index…
eernstg May 3, 2022
f2ab3dd
Adjust class building types
eernstg May 9, 2022
3376928
Adjust examples declaring non-nullable positional optional parameters…
eernstg Jul 26, 2022
c4bf445
Add a TODO to introduce `Any`
eernstg Nov 2, 2022
89f2941
Correct example in section about super-bounded types
eernstg Nov 3, 2022
bdb339b
Correction based on https://github.com/dart-lang/language/issues/2679
eernstg Dec 2, 2022
c48436f
Specify erasure of intersection types for the semantics of await expr…
eernstg Dec 9, 2022
8490256
Typo
eernstg Jan 20, 2023
f65d1c5
Introduce \DynamicError, marking all dynamic errors just like compile…
eernstg Feb 2, 2023
edff131
Changed the error margin markers to use red text
eernstg Feb 2, 2023
ab9108f
Correct dynamic type of tear-off with covariant parameter
eernstg May 31, 2023
56b44b8
Clarified tear-offs of methods with covariant parameters
eernstg May 31, 2023
94986b2
Correct a typo about closurization
eernstg May 31, 2023
1ff8b85
Correction: Add definition of normalizedType/topMergeType for member …
eernstg Jun 16, 2023
60b6348
Correction: Update dynamic type of covariant parameter to Object?
eernstg Jun 22, 2023
ee6bd6b
Typo
eernstg Jun 29, 2023
3bc427d
Add commentary to emphasize that `new`/`const` can be implicit, and `…
eernstg Jul 5, 2023
e07ffaf
Add missing updates in section typeVoid
eernstg Jul 6, 2023
5f2658b
Add missing error: default values must be type correct
eernstg Jul 13, 2023
097844a
Add a paragraph explaining that the given section is about both optio…
eernstg Jul 13, 2023
0c74d6c
Post-rebase error correction
eernstg Jul 21, 2023
bb18478
Correct usages of "final variable" and "constant variable"
eernstg Jul 21, 2023
f7b7a6b
Add missing declaration kind about getter/setter type error
eernstg Sep 11, 2023
e6de389
Remove obsolete reference to "mixin composition" from section Supercl…
eernstg Sep 29, 2023
65024fb
Add comment about default values of noSuchMethod forwarders being und…
eernstg Sep 29, 2023
c0040e0
Correct rule about the interface of T?
eernstg Jan 10, 2024
5429ded
Correct rule about interfaces of bounded types
eernstg Jan 10, 2024
41f67f8
Corrected many occurrences of "string" to "string literal"
eernstg Feb 22, 2024
a445d0e
Update the "parameter name `_...`" error
eernstg Apr 30, 2024
3289a87
Restore the index marker, define a command for it
eernstg Jun 17, 2024
921c774
Corrected the huge rebase operation (removed TODO material)
eernstg Jun 17, 2024
ccb40e6
Fix obsolete ref
eernstg Aug 12, 2024
27820da
Introduce <memberedDeclarationBody> and use it
eernstg Aug 12, 2024
dc8dfcf
Add change log entry
eernstg Aug 12, 2024
a510d09
WIP
eernstg Oct 17, 2024
5d76b73
Clarified class building types
eernstg Nov 14, 2024
aecbc16
Correct the order of "bind formals to actuals", which has been rather…
eernstg Nov 27, 2024
1579a4e
Correct the incorrect cleam that Null implements Object
eernstg Feb 14, 2025
0237ac6
Hide links
eernstg Feb 21, 2025
886c509
Add missing cases to the definition of interface types
eernstg Apr 9, 2025
717f18b
WIP
eernstg Apr 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Corrected many occurrences of "string" to "string literal"
  • Loading branch information
eernstg committed May 1, 2025
commit 41f67f849946b9a035d730d9b5c5b30bdbb79e20
43 changes: 23 additions & 20 deletions specification/dartLangSpec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9553,7 +9553,8 @@ \subsection{Strings}
\end{grammar}

\LMHash{}%
A string can be a sequence of single line strings and multiline strings.
A string literal can be a sequence of single line strings
and multiline strings.

\begin{grammar}
<singleLineString> ::= <RAW\_SINGLE\_LINE\_STRING>
Expand Down Expand Up @@ -9605,24 +9606,25 @@ \subsection{Strings}
\end{grammar}

\LMHash{}%
A single line string is delimited by
A single line string literal is delimited by
either matching single quotes or matching double quotes.

\commentary{%
Hence, \code{'abc'} and \code{"abc"} are both legal strings,
Hence, \code{'abc'} and \code{"abc"} are both legal string literals,
as are \code{'He said "To be or not to be" did he not?'} and
\code{"He said 'To be or not to be' didn't he?"}.
However, \code{"This'} is not a valid string, nor is \code{'this"}.%
However, \code{"This'} is not a valid string literal, nor is \code{'this"}.%
}

\commentary{%
The grammar ensures that a single line string cannot span more than
The grammar ensures that a single line string literal cannot span more than
one line of source code,
unless it includes an interpolated expression that spans multiple lines.%
}

\LMHash{}%
Adjacent strings are implicitly concatenated to form a single string literal.
Adjacent string literals are implicitly concatenated
to form a single string literal.

\commentary{%
Here is an example:%
Expand All @@ -9635,7 +9637,7 @@ \subsection{Strings}
\rationale{%
Dart also supports the operator + for string concatenation.

The + operator on Strings requires a String argument.
The + operator on \code{String}s requires a \code{String} argument.
It does not coerce its argument into a string.
This helps avoid puzzlers such as%
}
Expand All @@ -9660,17 +9662,17 @@ \subsection{Strings}
String interpolation works well for most cases.
The main situation where it is not fully satisfactory
is for string literals that are too large to fit on a line.
Multiline strings can be useful, but in some cases,
Multiline string literals can be useful, but in some cases,
we want to visually align the code.
This can be expressed by writing
smaller strings separated by whitespace, as shown here:%
smaller string literals separated by whitespace, as shown here:%
}

\begin{dartCode}
'Imagine this is a very long string that does not fit on a line. What shall we do? '
'Oh what shall we do? '
'We shall split it into pieces '
'like so'.
'like so.'
\end{dartCode}

\LMHash{}%
Expand Down Expand Up @@ -9755,22 +9757,23 @@ \subsection{Strings}
\end{grammar}

\LMHash{}%
Multiline strings are delimited by either
Multiline string literals are delimited by either
matching triples of single quotes or
matching triples of double quotes.
If the first line of a multiline string consists solely of
If the first line of a multiline string literal consists solely of
the whitespace characters defined by the production \synt{WHITESPACE}
(\ref{lexicalRules}),
possibly prefixed by \syntax{`\\'},
then that line is ignored,
including the line break at its end.

\rationale{%
The idea is to ignore a whitespace-only first line of a multiline string,
The idea is to ignore a whitespace-only first line of
a multiline string literal,
where whitespace is defined as tabs, spaces and the final line break.
These can be represented directly,
but since for most characters prefixing by backslash is
an identity in a non-raw string,
an identity in a non-raw string literal,
we allow those forms as well.%
}

Expand All @@ -9788,7 +9791,7 @@ \subsection{Strings}
}

\LMHash{}%
Strings support escape sequences for special characters.
String literals support escape sequences for special characters.
The escapes are:
\begin{itemize}
\item
Expand Down Expand Up @@ -9834,12 +9837,12 @@ \subsection{Strings}
\end{itemize}

\LMHash{}%
Any string may be prefixed with the character \lit{r},
indicating that it is a \Index{raw string},
Any string literal may be prefixed with the character \lit{r},
indicating that it is a \Index{raw string literal},
in which case no escapes or interpolations are recognized.

\LMHash{}%
Line breaks in a multiline string are represented by
Line breaks in a multiline string literal are represented by
the \synt{LINE\_BREAK} production.
A line break introduces a single newline character (U+000A)
into the string value.
Expand Down Expand Up @@ -9888,12 +9891,12 @@ \subsubsection{String Interpolation}

\commentary{%
The reader will note that the expression inside the interpolation
could itself include strings,
could itself include string literals,
which could again be interpolated recursively.%
}

\LMHash{}%
An unescaped \lit{\$} character in a string signifies
An unescaped \lit{\$} character in a string literal signifies
the beginning of an interpolated expression.
The \lit{\$} sign may be followed by either:
\begin{itemize}
Expand Down