Skip to content

Commit c825883

Browse files
Merge branch 'useCollectionExpr2' into useCollectionExpr
2 parents c9063d9 + 78da3ce commit c825883

File tree

18 files changed

+26
-25
lines changed

18 files changed

+26
-25
lines changed

src/Analyzers/CSharp/Analyzers/MakeStructMemberReadOnly/CSharpMakeStructMemberReadOnlyAnalyzer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System;
56
using System.Collections.Generic;
67
using System.Collections.Immutable;
78
using System.Diagnostics.CodeAnalysis;
@@ -140,7 +141,7 @@ private void AnalyzeBlock(
140141
return;
141142

142143
var (location, additionalLocation) = GetDiagnosticLocation(owningMethod, cancellationToken);
143-
if (location == null || additionalLocation is null || !context.ShouldAnalyzeSpan(location.SourceSpan))
144+
if (location == null || additionalLocation == null || !context.ShouldAnalyzeSpan(location.SourceSpan))
144145
return;
145146

146147
foreach (var blockOperation in context.OperationBlocks)

src/EditorFeatures/CSharpTest/Formatting/RazorLineFormattingOptionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void F () {}
5757
var documentInfo = DocumentInfo.Create(
5858
DocumentId.CreateNewId(project.Id),
5959
name: "file.razor.g.cs",
60-
folders: Array.Empty<string>(),
60+
folders: [],
6161
sourceCodeKind: SourceCodeKind.Regular,
6262
loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create(), "file.razor.g.cs")),
6363
filePath: "file.razor.g.cs")

src/EditorFeatures/Test/Completion/FileSystemCompletionHelperTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void GetItems_Windows_Network()
161161
searchPaths: [],
162162
baseDirectoryOpt: null,
163163
allowableExtensions: [".cs"],
164-
drives: Array.Empty<string>(),
164+
drives: [],
165165
directories: new[]
166166
{
167167
@"\\server\share",
@@ -191,7 +191,7 @@ public void GetItems_Unix1()
191191
searchPaths: [@"/A", @"/B"],
192192
baseDirectoryOpt: @"/C",
193193
allowableExtensions: [".abc", ".def"],
194-
drives: Array.Empty<string>(),
194+
drives: [],
195195
directories: new[]
196196
{
197197
@"/A",

src/EditorFeatures/Test/Utilities/SymbolEquivalenceComparerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,8 +1830,8 @@ .method public instance int32[] F( // 3
18301830
r2 = MetadataReference.CreateFromImage(bytes);
18311831
}
18321832

1833-
var c1 = (Compilation)CS.CSharpCompilation.Create("comp1", Array.Empty<SyntaxTree>(), [NetFramework.mscorlib, r1]);
1834-
var c2 = (Compilation)CS.CSharpCompilation.Create("comp2", Array.Empty<SyntaxTree>(), [NetFramework.mscorlib, r2]);
1833+
var c1 = (Compilation)CS.CSharpCompilation.Create("comp1", [], [NetFramework.mscorlib, r1]);
1834+
var c2 = (Compilation)CS.CSharpCompilation.Create("comp2", [], [NetFramework.mscorlib, r2]);
18351835
var type1 = (ITypeSymbol)c1.GlobalNamespace.GetMembers("C").Single();
18361836
var type2 = (ITypeSymbol)c2.GlobalNamespace.GetMembers("C").Single();
18371837

src/Features/TestUtilities/EditAndContinue/EditAndContinueWorkspaceTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ internal static DocumentInfo CreateDesignTimeOnlyDocument(ProjectId projectId, s
368368
return DocumentInfo.Create(
369369
DocumentId.CreateNewId(projectId, name),
370370
name: name,
371-
folders: Array.Empty<string>(),
371+
folders: [],
372372
sourceCodeKind: SourceCodeKind.Regular,
373373
loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create(), path)),
374374
filePath: path,

src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,39 +83,39 @@ internal void VerifyEncLog(IEnumerable<EditAndContinueLogEntry>? expected = null
8383
=> Verify(() =>
8484
{
8585
AssertEx.Equal(
86-
expected ?? Array.Empty<EditAndContinueLogEntry>(),
86+
expected ?? [],
8787
MetadataReader.GetEditAndContinueLogEntries(), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog doesn't match"));
8888
});
8989

9090
internal void VerifyEncMap(IEnumerable<EntityHandle>? expected = null)
9191
=> Verify(() =>
9292
{
9393
AssertEx.Equal(
94-
expected ?? Array.Empty<EntityHandle>(),
94+
expected ?? [],
9595
MetadataReader.GetEditAndContinueMapEntries(), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap doesn't match"));
9696
});
9797

9898
internal void VerifyEncLogDefinitions(IEnumerable<EditAndContinueLogEntry>? expected = null)
9999
=> Verify(() =>
100100
{
101101
AssertEx.Equal(
102-
expected ?? Array.Empty<EditAndContinueLogEntry>(),
102+
expected ?? [],
103103
MetadataReader.GetEditAndContinueLogEntries().Where(e => IsDefinition(e.Handle.Kind)), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog definitions don't match"));
104104
});
105105

106106
internal void VerifyEncMapDefinitions(IEnumerable<EntityHandle>? expected = null)
107107
=> Verify(() =>
108108
{
109109
AssertEx.Equal(
110-
expected ?? Array.Empty<EntityHandle>(),
110+
expected ?? [],
111111
MetadataReader.GetEditAndContinueMapEntries().Where(e => IsDefinition(e.Kind)), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap definitions don't match"));
112112
});
113113

114114
internal void VerifyCustomAttributes(IEnumerable<CustomAttributeRow>? expected = null)
115115
=> Verify(() =>
116116
{
117117
AssertEx.Equal(
118-
expected ?? Array.Empty<CustomAttributeRow>(),
118+
expected ?? [],
119119
MetadataReader.GetCustomAttributeRows(), itemInspector: AttributeRowToString);
120120
});
121121

src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static ImmutableArray<DocumentSymbolDataViewModel> Sort(ImmutableArray<DocumentS
9696
static DocumentSymbolDataViewModel ReplaceChildren(DocumentSymbolDataViewModel symbolToUpdate, ImmutableArray<DocumentSymbolDataViewModel> newChildren)
9797
{
9898
var data = symbolToUpdate.Data;
99-
var symbolData = data with { Children = ImmutableArray<DocumentSymbolData>.Empty };
99+
var symbolData = data with { Children = [] };
100100
return new DocumentSymbolDataViewModel(symbolData, newChildren);
101101
}
102102

src/VisualStudio/CSharp/Test/EditorConfigSettings/DataProvider/DataProviderTests.MockAnalyzerReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages()
5050
=> Analyzers;
5151

5252
public ImmutableArray<CodeFixProvider> GetFixers()
53-
=> Fixer != null ? [Fixer] : ImmutableArray<CodeFixProvider>.Empty;
53+
=> Fixer != null ? [Fixer] : [];
5454

5555
public class MockFixer : CodeFixProvider
5656
{

src/VisualStudio/Core/Def/EditAndContinue/EditAndContinueFeedbackDiagnosticFileProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private string GetZipFilePath()
9898

9999
public IReadOnlyCollection<string> GetFiles()
100100
=> _vsFeedbackSemaphoreFileWatcher is null
101-
? Array.Empty<string>()
101+
? []
102102
: (IReadOnlyCollection<string>)([GetZipFilePath()]);
103103

104104
private void OnFeedbackSemaphoreCreatedOrChanged()

src/VisualStudio/Core/Def/EditorConfigSettings/SettingsEditorPane.SearchFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal class SearchFilter : IEntryFilter
2020
public SearchFilter(IVsSearchQuery searchQuery, IWpfTableControl control)
2121
{
2222
_searchTokens = SearchUtilities.ExtractSearchTokens(searchQuery);
23-
_searchTokens ??= Array.Empty<IVsSearchToken>();
23+
_searchTokens ??= [];
2424

2525
var newVisibleColumns = new List<ITableColumnDefinition>();
2626
foreach (var c in control.ColumnStates)

0 commit comments

Comments
 (0)