Skip to content

Commit 8040dd3

Browse files
authored
Merge pull request #55771 from dotnet/merges/main-to-main-vs-deps
Merge main to main-vs-deps
2 parents ac1052a + 8bc4c14 commit 8040dd3

File tree

38 files changed

+261
-119
lines changed

38 files changed

+261
-119
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## This document lists known breaking changes in Roslyn in C# 10.0 which will be introduced with .NET 6.
2+
3+
1. Beginning with C# 10.0, null suppression operator is no longer allowed in patterns.
4+
```csharp
5+
void M(object o)
6+
{
7+
if (o is null!) {} // error
8+
}
9+
```

src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses;
1212
using Microsoft.CodeAnalysis.Diagnostics;
1313
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
14+
using Microsoft.CodeAnalysis.Shared.Extensions;
1415
using Microsoft.CodeAnalysis.Test.Utilities;
1516
using Microsoft.CodeAnalysis.Text;
1617
using Roslyn.Test.Utilities;
@@ -44,7 +45,7 @@ private async Task TestAsync(string initial, string expected, bool offeredWhenRe
4445
}
4546

4647
internal override bool ShouldSkipMessageDescriptionVerification(DiagnosticDescriptor descriptor)
47-
=> descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary) && descriptor.DefaultSeverity == DiagnosticSeverity.Hidden;
48+
=> descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary) && descriptor.DefaultSeverity == DiagnosticSeverity.Hidden;
4849

4950
private static DiagnosticDescription GetRemoveUnnecessaryParenthesesDiagnostic(string text, int line, int column)
5051
=> TestHelpers.Diagnostic(IDEDiagnosticIds.RemoveUnnecessaryParenthesesDiagnosticId, text, startLocation: new LinePosition(line, column));

src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryPatternParenthesesTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses;
1212
using Microsoft.CodeAnalysis.Diagnostics;
1313
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
14+
using Microsoft.CodeAnalysis.Shared.Extensions;
1415
using Microsoft.CodeAnalysis.Test.Utilities;
1516
using Roslyn.Test.Utilities;
1617
using Xunit;
@@ -43,7 +44,7 @@ private async Task TestAsync(string initial, string expected, bool offeredWhenRe
4344
}
4445

4546
internal override bool ShouldSkipMessageDescriptionVerification(DiagnosticDescriptor descriptor)
46-
=> descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary) && descriptor.DefaultSeverity == DiagnosticSeverity.Hidden;
47+
=> descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary) && descriptor.DefaultSeverity == DiagnosticSeverity.Hidden;
4748

4849
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessaryParentheses)]
4950
public async Task TestArithmeticRequiredForClarity2()

src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
3737
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
3838

3939
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
40-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
40+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
4141

4242
public override Task RegisterCodeFixesAsync(CodeFixContext context)
4343
{

src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
3636
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
3737

3838
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
39-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
39+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
4040

4141
public override Task RegisterCodeFixesAsync(CodeFixContext context)
4242
{

src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
4646
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
4747

4848
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
49-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
49+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
5050

5151
public override Task RegisterCodeFixesAsync(CodeFixContext context)
5252
{

src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
4848
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
4949

5050
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
51-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
51+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
5252

5353
public override Task RegisterCodeFixesAsync(CodeFixContext context)
5454
{

src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
4444
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
4545

4646
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
47-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
47+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
4848

4949
public override Task RegisterCodeFixesAsync(CodeFixContext context)
5050
{

src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.CodeAnalysis.CodeFixes;
1616
using Microsoft.CodeAnalysis.Diagnostics;
1717
using Microsoft.CodeAnalysis.Editing;
18+
using Microsoft.CodeAnalysis.Shared.Extensions;
1819
using Roslyn.Utilities;
1920

2021
namespace Microsoft.CodeAnalysis.UseThrowExpression
@@ -35,7 +36,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
3536
internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle;
3637

3738
protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
38-
=> !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary);
39+
=> !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary);
3940

4041
public override Task RegisterCodeFixesAsync(CodeFixContext context)
4142
{

src/Analyzers/VisualBasic/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryParenthesesTests.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.RemoveUnnecessaryP
2727
End Function
2828

2929
Friend Overrides Function ShouldSkipMessageDescriptionVerification(descriptor As DiagnosticDescriptor) As Boolean
30-
Return descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary) And descriptor.DefaultSeverity = DiagnosticSeverity.Hidden
30+
Return descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary) And descriptor.DefaultSeverity = DiagnosticSeverity.Hidden
3131
End Function
3232

3333
Private Shadows Async Function TestAsync(initial As String, expected As String,

0 commit comments

Comments
 (0)