Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid formatting diagnostics with raw strings #60655

Merged
merged 2 commits into from
Apr 13, 2022
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
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "6.2.315104",
"version": "6.3.317301",
"commands": [
"dotnet-format"
]
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.22122.4</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.132-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
<CodeStyleAnalyzerVersion>4.1.0</CodeStyleAnalyzerVersion>
<CodeStyleAnalyzerVersion>4.2.0-2.final</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>17.2.178-preview</VisualStudioEditorPackagesVersion>
<VisualStudioEditorNewPackagesVersion>17.2.140-preview-ga1e1777dca</VisualStudioEditorNewPackagesVersion>
<ILAsmPackageVersion>5.0.0-alpha1.19409.1</ILAsmPackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3133,12 +3133,13 @@ public void RefAssignment_Foreach()

void verify(string variableType, string itemType, params DiagnosticDescription[] expected)
{
var source = @"
var source = $$"""

class C<T>
{
void M(RefEnumerable collection)
{
foreach (ref VARTYPE item in collection)
foreach (ref {{variableType}} item in collection)
{
item.ToString();
}
Expand All @@ -3149,13 +3150,14 @@ class RefEnumerable
public StructEnum GetEnumerator() => throw null!;
public struct StructEnum
{
public ref ITEMTYPE Current => throw null!;
public ref {{itemType}} Current => throw null!;
public bool MoveNext() => throw null!;
}
}
}";
}
""";

var comp = CreateCompilation(source.Replace("VARTYPE", variableType).Replace("ITEMTYPE", itemType), options: WithNullableEnable());
var comp = CreateCompilation(source, options: WithNullableEnable());
comp.VerifyDiagnostics(expected);
}
}
Expand Down