-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Remove more usages of specialized collections in favor of collection exprs #72918
Conversation
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
Outdated
Show resolved
Hide resolved
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.
@@ -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); |
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.
We generally do not welcome changes like this under Compilers.
Odd. This wasn't meant to touch the compiler. Will revert. |
@@ -71,7 +71,7 @@ public static ICollection<ISymbol> GetMissingEnumMembers(ISwitchOperation switch | |||
if (!TryGetAllEnumMembers(switchExpressionType, enumMembers) || | |||
!TryRemoveExistingEnumMembers(switchStatement, enumMembers)) | |||
{ | |||
return SpecializedCollections.EmptyCollection<ISymbol>(); | |||
return []; |
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.
{ | ||
return SpecializedCollections.EmptyList<TextChange>(); | ||
} | ||
return []; |
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.
@@ -35,7 +35,7 @@ public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span) | |||
return classifications.Where(c => c.Span.IntersectsWith(span)).ToList(); | |||
} | |||
|
|||
return SpecializedCollections.EmptyList<ClassificationSpan>(); | |||
return []; |
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.
@@ -55,7 +55,7 @@ public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span) | |||
} | |||
} | |||
|
|||
return SpecializedCollections.EmptyList<ClassificationSpan>(); | |||
return []; |
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.
@@ -97,7 +97,7 @@ private static IList<ITextView> GetTextViews(ITextBuffer textBuffer) | |||
{ | |||
if (!s_map.TryGetValue(textBuffer, out var set)) | |||
{ | |||
return SpecializedCollections.EmptyList<ITextView>(); | |||
return []; |
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.
@@ -632,7 +632,7 @@ private void LogRenameSession(RenameLogMessage.UserActionOutcome outcome, bool p | |||
outcome, | |||
conflictResolutionFinishedComputing, | |||
previewChanges, | |||
SpecializedCollections.EmptyList<InlineRenameReplacementKind>())); | |||
replacementKinds: [])); |
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.
@@ -269,7 +269,7 @@ private static IList<string> CollectLogHubFilePaths() | |||
// ignore failures | |||
} | |||
|
|||
return SpecializedCollections.EmptyList<string>(); | |||
return []; |
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.
@@ -84,7 +84,7 @@ public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancel | |||
if (previousToken.Kind() == SyntaxKind.None) | |||
{ | |||
// no previous token. nothing to format | |||
return SpecializedCollections.EmptyList<TextChange>(); | |||
return []; |
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.
@@ -52,7 +50,7 @@ public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSp | |||
|
|||
if (spansToFormat.Count == 0) | |||
{ | |||
return CreateAggregatedFormattingResult(node, SpecializedCollections.EmptyList<AbstractFormattingResult>()); | |||
return CreateAggregatedFormattingResult(node, results: []); |
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.
@@ -72,7 +70,7 @@ public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSp | |||
// quick simple case check | |||
if (results == null) | |||
{ | |||
return CreateAggregatedFormattingResult(node, SpecializedCollections.EmptyList<AbstractFormattingResult>()); | |||
return CreateAggregatedFormattingResult(node, results: []); |
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.
return info == null | ||
? SpecializedCollections.EmptyList<ISymbol>() | ||
: info._imports; | ||
return info == null ? [] : info._imports; |
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.
No description provided.