mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-10 12:28:25 +00:00
Use ASCII quotes in character literal examples in p1964 (#7938)
The examples in the "Types" section of the character literals proposal delimited character literals with typographic quotes (U+2018/U+2019) instead of ASCII `'`, so copying them produces invalid Carbon. No other Markdown file in the repository has typographic quotes inside code. Fixes #7424 Assisted-by: Claude Code with Claude Opus 5.5 Co-authored-by: popcoder565 <339285150+popcoder565@users.noreply.github.com>
This commit is contained in:
1 parent
2302272643
commit
59d53ab0a3
1 file changed
+5
-5
@@ -147,25 +147,25 @@ are examples of character literals for each specific type:
|
||||
|
||||
`let allowed: Char8 = 'a'`
|
||||
|
||||
In this example, the character literal `’a’` corresponds to the Unicode code
|
||||
In this example, the character literal `'a'` corresponds to the Unicode code
|
||||
point `97`, which is within the valid range of `Char8` since `97` is less than
|
||||
or equal to `0x7F`.
|
||||
|
||||
- `Char16`: The character literal represents a Unicode code point that can be
|
||||
represented within 16 bits. Here’s an example:
|
||||
|
||||
`let smiley: Char16 = ‘\u{1F600}’`
|
||||
`let smiley: Char16 = '\u{1F600}'`
|
||||
|
||||
The character literal `’\u{1F600}’` represents the smiley face emoji, which has
|
||||
The character literal `'\u{1F600}'` represents the smiley face emoji, which has
|
||||
the Unicode code point `128512`. Since `128512` can be represented within 16
|
||||
bits, it can be assigned to a variable of type `Char16`.
|
||||
|
||||
- `Char32`: This character type allows the representation of Unicode code
|
||||
points within 32 bits. Here’s an example:
|
||||
|
||||
`let musicalNote: Char32 = ‘🎵’`
|
||||
`let musicalNote: Char32 = '🎵'`
|
||||
|
||||
In this case, the character literal `’🎵’` corresponds to the musical note emoji
|
||||
In this case, the character literal `'🎵'` corresponds to the musical note emoji
|
||||
with the Unicode code point `127925`. Since `127925` falls within the range that
|
||||
can be represented by `Char32`, it can be assigned to a variable of type
|
||||
`Char32`.
|
||||
|
||||
Reference in new issue
Block a user