-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Remove more usages of specialized collections in favor of collection exprs #72918
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
Changes from all commits
2338503
7131928
9e3ae85
539cb73
5d25d39
fef845d
2d21c07
876ebb8
a289dad
8f58021
5625f34
c70dd76
07ff580
3f5ab62
03d5a57
0c6bfa9
43e919e
e9710f5
ed1074e
77ecaac
b877438
fdb859c
dec1564
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNo | |
|
|
||
| internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNode node, bool getSymbol, SyntaxNode executableCodeBlock, CancellationToken cancellationToken) | ||
| { | ||
| return GetDeclarationInfo(model, node, getSymbol, SpecializedCollections.SingletonEnumerable(executableCodeBlock), cancellationToken); | ||
| return GetDeclarationInfo(model, node, getSymbol, [executableCodeBlock], cancellationToken); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We generally do not welcome changes like this under Compilers. |
||
| } | ||
|
|
||
| internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNode node, bool getSymbol, CancellationToken cancellationToken, params SyntaxNode[] executableCodeBlocks) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,9 +98,7 @@ protected override IList<TextChange> FormatBasedOnEndToken(ParsedDocument docume | |
| var endToken = root.FindToken(position); | ||
| var span = GetFormattedTextSpan(root, endToken); | ||
| if (span == null) | ||
| { | ||
| return SpecializedCollections.EmptyList<TextChange>(); | ||
| } | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| var formatter = document.LanguageServices.GetRequiredService<ISyntaxFormattingService>(); | ||
| return formatter.GetFormattingResult( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span) | |
| return classifications.Where(c => c.Span.IntersectsWith(span)).ToList(); | ||
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<ClassificationSpan>(); | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span) | |
| } | ||
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<ClassificationSpan>(); | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ private static IList<ITextView> GetTextViews(ITextBuffer textBuffer) | |
| { | ||
| if (!s_map.TryGetValue(textBuffer, out var set)) | ||
| { | ||
| return SpecializedCollections.EmptyList<ITextView>(); | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| return set.ToList(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -632,7 +632,7 @@ private void LogRenameSession(RenameLogMessage.UserActionOutcome outcome, bool p | |
| outcome, | ||
| conflictResolutionFinishedComputing, | ||
| previewChanges, | ||
| SpecializedCollections.EmptyList<InlineRenameReplacementKind>())); | ||
| replacementKinds: [])); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,9 +94,7 @@ internal static IList<T> SelectMatchingExtensionValues<T, TMetadata>( | |
| where TMetadata : ILanguageMetadata | ||
| { | ||
| if (items == null) | ||
| { | ||
| return SpecializedCollections.EmptyList<T>(); | ||
| } | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| return items.Where(lazy => LanguageMatches(lazy.Metadata.Language, contentType, workspaceServices)). | ||
| Select(lazy => lazy.Value).ToList(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ protected override void ParseText( | |
| } | ||
| else | ||
| { | ||
| nameParts = SpecializedCollections.EmptyList<NameAndArity>(); | ||
| nameParts = []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,5 +77,5 @@ protected static SignatureHelpSymbolParameter Convert( | |
| #pragma warning disable CA1822 // Mark members as static - see obsolete message above. | ||
| protected IList<TaggedText> GetAwaitableUsage(IMethodSymbol method, SemanticModel semanticModel, int position) | ||
| #pragma warning restore CA1822 // Mark members as static | ||
| => SpecializedCollections.EmptyList<TaggedText>(); | ||
| => []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -480,9 +480,7 @@ private async Task<ImmutableArray<CodeActionOperation>> GetGenerateIntoExistingD | |
| { | ||
| string includeUsingsOrImports = null; | ||
| if (!areFoldersValidIdentifiers) | ||
| { | ||
| folders = SpecializedCollections.EmptyList<string>(); | ||
| } | ||
| folders = []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // Now actually create the symbol that we want to add to the root namespace. The | ||
| // symbol may either be a named type (if we're not generating into a namespace) or | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,9 +23,7 @@ internal sealed class SupportedPlatformData(Solution solution, List<ProjectId> i | |
| public IList<SymbolDisplayPart> ToDisplayParts() | ||
| { | ||
| if (InvalidProjects == null || InvalidProjects.Count == 0) | ||
| { | ||
| return SpecializedCollections.EmptyList<SymbolDisplayPart>(); | ||
| } | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| var builder = new List<SymbolDisplayPart>(); | ||
| builder.AddLineBreak(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -781,7 +781,7 @@ internal GenerateTypeDialogViewModel( | |
| } | ||
| else | ||
| { | ||
| this.ProjectFolders = SpecializedCollections.EmptyList<string>(); | ||
| this.ProjectFolders = []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,8 +52,8 @@ public NavigationBarClient( | |
|
|
||
| _workspace = workspace; | ||
| _imageService = (IVsImageService2)serviceProvider.GetService(typeof(SVsImageService)); | ||
| _projectItems = SpecializedCollections.EmptyList<NavigationBarProjectItem>(); | ||
| _currentTypeItems = SpecializedCollections.EmptyList<NavigationBarItem>(); | ||
| _projectItems = []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| _currentTypeItems = []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| private NavigationBarItem? GetCurrentTypeItem() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,9 +52,7 @@ private IList<TextSpanAndCookie> EnumOriginalCodeBlocksWorker(CancellationToken | |
| var snapshot = this.SubjectBuffer.CurrentSnapshot; | ||
| var document = snapshot.GetOpenDocumentInCurrentContextWithChanges(); | ||
| if (document == null) | ||
| { | ||
| return SpecializedCollections.EmptyList<TextSpanAndCookie>(); | ||
| } | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| return document.GetVisibleCodeBlocks(cancellationToken) | ||
| .Select(tuple => new TextSpanAndCookie | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,7 +269,7 @@ private static IList<string> CollectLogHubFilePaths() | |
| // ignore failures | ||
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<string>(); | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| private static IList<string> CollectServiceHubLogFilePaths() | ||
|
|
@@ -291,7 +291,7 @@ private static IList<string> CollectServiceHubLogFilePaths() | |
| // ignore failures | ||
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<string>(); | ||
| return []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| private static List<string> CollectFilePaths(string logDirectoryPath, string logFileExtension, Func<string, bool> shouldExcludeLogFile) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ What type gets constructed for this case? I would expect this change introduced a new allocation due to the return type.