Skip to content

[Test Plan] Interpolated String Improvements #51499

@333fred

Description

@333fred

Proposal: ​
dotnet/csharplang#4487

Spec:
https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/improved-interpolated-strings.md

Feature Branch:
https://github.com/dotnet/roslyn/tree/features/interpolated-string

Compiler:

  • LangVersion
  • DefaultInterpolatedStringHandler
    • Not present
    • Present
    • Malformed
    • In an async method with no await holes
    • In an async method with await holes
  • Binary operator combination of interpolated strings
    • + operator
    • + operator with non interp string
  • Custom InterpolatedStringHandler
    • Incorrect ctor
      • implicit conversions to int?
  • Missing AppendLiteral
  • Incorect AppendLiteral
    • Not return bool or void
  • Missing AppendFormatted
  • Incorrect AppendFormatted
    • Not return bool or void
  • Mismatched AppendFormatted and AppendLiteral return types
  • Handler overloads
    • Pick handler over regular string for non-const
    • Regular string over handler for const
    • Handler over conversion to string
    • Handler overloads with arguments:
      • val over in
      • val over ref
  • Handler args as:
    • val
    • ref
    • in
    • implicit ref (allow mismatch)
    • out
    • normal / expanded form
    • other params after handler param
    • default values
    • reordered at call site
  • InterpolatedStringHandlerArgumentAttribute
    • Missing
    • Malformed
  • Parameter names
    • Single parameter name
    • Multiple parameters
    • ""
      • Passes this
      • On a static method
      • On a ctor
    • Incorrect parameter name
    • Mix of correct and incorrect param names
    • Referring to self
  • Nullable analysis for format holes and handler constructor (issue Proper nullable support for interpolated string handler constructors and conversions #54583)
  • Await in interpolation hole
    • Ref parameter
  • Dynamic handler
  • IOperation
  • Control Flow Graph
  • Semantic model
    • GetConstantValue on additive expressions

Productivity:

  • Intellisense for methods that have builder arguments
  • Verify experience on some methods/overloads that will get builders (string.Create, Debug.Assert, Debug.Write{Line}If, StringBuilder.Append{Line}, MemoryExtensions.TryWrite)
  • Extract interpolated string to a local (risks changing meaning/perf)
  • Find all refs on custom handler type and constructor, and append methods
  • go to definition

LDM:

  • conversion operator to string? (details) (answer: no)
  • parentheses and additive expressions (details) (answer: allow parens and suppressions)

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions