-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Speclet - https://github.com/dotnet/csharplang/blob/main/proposals/csharp-11.0/utf8-string-literals.md
Feature branch - https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals
Championed issue - dotnet/csharplang#184
Compiler
- LangVer
- for
u8suffix
- for
- compiler test plan
- parsing
-
u8andU8suffix allowed - no trivia between string constant and
u8suffix - single and multi-line verbatim strings
- single and multi-line raw string literals
- interpolated strings with suffix disallowed
- disallowed in
#directives
-
- natural type of
"abc"u8isReadOnlySpan<byte>:NaturalType_01 - no target type of constant string with
u8suffix tobyte[]orSpan<byte>:ImplicitConversions_02 - explicit conversion from constant string with
u8suffix toSpan<byte>, orbyte[]is disallowed:ExplicitConversions_02 - implicit/explicit conversion from constant string to
ReadOnlySpan<byte>,Span<byte>, orbyte[]is disallowed:ImplicitConversions_01 - implicit/explicit conversion from non-constant string to
ReadOnlySpan<byte>,Span<byte>, orbyte[]is disallowed:NoConversionFromNonConstant_01,_02 - implicit/explicit conversion from
nulltoReadOnlySpan<byte>,Span<byte>, orbyte[]is allowed (unchanged):NoBehaviorChangeForConversionFromNullLiteral_01 - implicit/explicit conversion from
(object)nulltoReadOnlySpan<byte>,Span<byte>, orbyte[]is disallowed:ImplicitConversions_04,ExplicitConversions_04 - implicit/explicit conversion from
(string)nulltoReadOnlySpan<byte>,Span<byte>, orbyte[]is disallowed:ImplicitConversions_03,ExplicitConversions_03 - error reported for invalid UTF8 in
u8string:InvalidContent_02,_03 - pattern matching
ReadOnlySpan<byte>against string constants:PatternMatching_01,_02,_03 - Expression tree use or implicit conversion and
u8literal disallowed - UTF8
byte[]stored in<PrivateImplementationDetails>if Length > 2 - pattern matching
ReadOnlySpan<byte>against string constants:PatternMatching_01,_02,_03 - Expression tree use or implicit conversion and
u8literal disallowed - UTF8
byte[]stored in<PrivateImplementationDetails>if Length > 2 - concatenation:
UserDefinedConcatenation_01, etc. -
const ReadOnlySpan<byte> x = "abc"u8;is disallowed:NotConstant_01 -
void M(Span<byte> x = "abc"u8)is disallowed:DefaultParameterValues_01,_02 -
"abc"u8and implicit conversion disallowed in attribute value:AttributeArgument_01, etc. - nullability of
"abc"u8:NullableAnalysis_03 - Missing and invalid type and members:
ReadOnlySpan<T>,Span<T>, etc. -
Document breaking changes(none) - IOperation:
IOperationTests_IUtf8StringOperation -
GetTypeInfo() -
GetConversion() - EE
- EnC with
<PrivateImplementationDetails> - SyntaxNormalizer: string, single and multi-line raw string
- null terminator:
NullTerminate_01,_02
Public API
IDE
- SyntaxClassifier: string, single and multi-line raw string
- QuickInfo:
byte[]natural type
Debugger
- Can/should we show the string (rather than just bytes) when hovering over such variables? (There's discussion on csharplang on this and decompilation experience)
Other
- LDM:
readonlySpanOfByte is "abc"orreadonlySpanOfByte is "abc"u8? (also reported here and here) [Proposal]: UTF-8 Literal Pattern Matching Support csharplang#6161 - LDM: confirm whether the conversion part of the feature is desirable (answer: no)
- LDM: confirm whether the suffix part of the feature is desirable (answer: yes)
- LDM: allow concatenation? (issue) Implement concatenation operator for "u8" literals. #62044
- Update utf8-string-literals.md to reflect LDM decisions
Reactions are currently unavailable