Skip to content

Test plan for Utf8StringLiterals feature. #58848

@AlekseyTs

Description

@AlekseyTs

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 u8 suffix
  • compiler test plan
  • parsing
    • u8 and U8 suffix allowed
    • no trivia between string constant and u8 suffix
    • 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"u8 is ReadOnlySpan<byte>: NaturalType_01
  • no target type of constant string with u8 suffix to byte[] or Span<byte>: ImplicitConversions_02
  • explicit conversion from constant string with u8 suffix to Span<byte>, or byte[] is disallowed: ExplicitConversions_02
  • implicit/explicit conversion from constant string to ReadOnlySpan<byte>, Span<byte>, or byte[] is disallowed: ImplicitConversions_01
  • implicit/explicit conversion from non-constant string to ReadOnlySpan<byte>, Span<byte>, or byte[] is disallowed: NoConversionFromNonConstant_01, _02
  • implicit/explicit conversion from null to ReadOnlySpan<byte>, Span<byte>, or byte[] is allowed (unchanged): NoBehaviorChangeForConversionFromNullLiteral_01
  • implicit/explicit conversion from (object)null to ReadOnlySpan<byte>, Span<byte>, or byte[] is disallowed: ImplicitConversions_04, ExplicitConversions_04
  • implicit/explicit conversion from (string)null to ReadOnlySpan<byte>, Span<byte>, or byte[] is disallowed: ImplicitConversions_03, ExplicitConversions_03
  • error reported for invalid UTF8 in u8 string: InvalidContent_02, _03
  • pattern matching ReadOnlySpan<byte> against string constants: PatternMatching_01, _02, _03
  • Expression tree use or implicit conversion and u8 literal 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 u8 literal 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"u8 and 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions