Remove more usages of specialized collections in favor of collection exprs#72918
Remove more usages of specialized collections in favor of collection exprs#72918CyrusNajmabadi merged 23 commits intodotnet:mainfrom
Conversation
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
Outdated
Show resolved
Hide resolved
| 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); |
There was a problem hiding this comment.
We generally do not welcome changes like this under Compilers.
|
Odd. This wasn't meant to touch the compiler. Will revert. |
| !TryRemoveExistingEnumMembers(switchStatement, enumMembers)) | ||
| { | ||
| return SpecializedCollections.EmptyCollection<ISymbol>(); | ||
| return []; |
There was a problem hiding this comment.
❓ What type gets constructed for this case? I would expect this change introduced a new allocation due to the return type.
| { | ||
| return SpecializedCollections.EmptyList<TextChange>(); | ||
| } | ||
| return []; |
There was a problem hiding this comment.
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<ClassificationSpan>(); | ||
| return []; |
There was a problem hiding this comment.
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<ClassificationSpan>(); | ||
| return []; |
There was a problem hiding this comment.
| if (!s_map.TryGetValue(textBuffer, out var set)) | ||
| { | ||
| return SpecializedCollections.EmptyList<ITextView>(); | ||
| return []; |
There was a problem hiding this comment.
| conflictResolutionFinishedComputing, | ||
| previewChanges, | ||
| SpecializedCollections.EmptyList<InlineRenameReplacementKind>())); | ||
| replacementKinds: [])); |
There was a problem hiding this comment.
| } | ||
|
|
||
| return SpecializedCollections.EmptyList<string>(); | ||
| return []; |
There was a problem hiding this comment.
| { | ||
| // no previous token. nothing to format | ||
| return SpecializedCollections.EmptyList<TextChange>(); | ||
| return []; |
There was a problem hiding this comment.
| if (spansToFormat.Count == 0) | ||
| { | ||
| return CreateAggregatedFormattingResult(node, SpecializedCollections.EmptyList<AbstractFormattingResult>()); | ||
| return CreateAggregatedFormattingResult(node, results: []); |
There was a problem hiding this comment.
| if (results == null) | ||
| { | ||
| return CreateAggregatedFormattingResult(node, SpecializedCollections.EmptyList<AbstractFormattingResult>()); | ||
| return CreateAggregatedFormattingResult(node, results: []); |
There was a problem hiding this comment.
| return info == null | ||
| ? SpecializedCollections.EmptyList<ISymbol>() | ||
| : info._imports; | ||
| return info == null ? [] : info._imports; |
There was a problem hiding this comment.
No description provided.