Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix [RCS1084](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1084.md) ([#1085](https://github.com/josefpihrt/roslynator/pull/1085)).
- Fix [RCS1169](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1169.md) ([#1092](https://github.com/JosefPihrt/Roslynator/pull/1092)).
- Recognize more shapes of IAsyncEnumerable as being Async ([RCS1047](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1047.md)) ([#1084](https://github.com/josefpihrt/roslynator/pull/1084)).
- Fix [RCS1197](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1197.md) ([#1093](https://github.com/JosefPihrt/Roslynator/pull/1093)).

## [4.3.0] - 2023-04-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,38 @@ void M()
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.OptimizeStringBuilderAppendCall)]
public async Task Test_InterpolatedString_WithFormat_AppendLine2()
{
await VerifyDiagnosticAndFixAsync(@"
using System;
using System.Text;

class C
{
void M(DateTime x)
{
string s = null;
var sb = new StringBuilder();
sb.Append([|$@""{x:hh\:mm\:ss\.fff}""|]).ToString();
}
}
", @"
using System;
using System.Text;

class C
{
void M(DateTime x)
{
string s = null;
var sb = new StringBuilder();
sb.AppendFormat(@""{0:hh\:mm\:ss\.fff}"", x).ToString();
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.OptimizeStringBuilderAppendCall)]
public async Task Test_Concatenation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public static (SyntaxKind contentKind, string methodName, ImmutableArray<Argumen
{
StringBuilder sb = StringBuilderCache.GetInstance();

if (isVerbatim)
sb.Append("@");

sb.Append("\"{0");

if (alignmentClause is not null)
Expand Down