Skip to content
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

Merged
merged 23 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Specialized collectoin
  • Loading branch information
CyrusNajmabadi committed Apr 7, 2024
commit 9e3ae85f02de0bf3e99852cf592c525a810b64ad
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected override void ParseText(
}
else
{
nameParts = SpecializedCollections.EmptyList<NameAndArity>();
nameParts = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This appears to be a new allocation

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
=> [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This appears to be a new allocation

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void SyntaxNodeAction(
Descriptor, isExpression.GetLocation(),
styleOption.Notification,
context.Options,
SpecializedCollections.EmptyCollection<Location>(),
additionalLocations: [],
ImmutableDictionary<string, string?>.Empty));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ void Method()
new CodeChangeProviderMetadata("SuppressionProvider", languages: [LanguageNames.CSharp]));
var fixService = new CodeFixService(
diagnosticService,
SpecializedCollections.EmptyEnumerable<Lazy<IErrorLoggerService>>(),
SpecializedCollections.EmptyEnumerable<Lazy<CodeFixProvider, CodeChangeProviderMetadata>>(),
loggers: [],
fixers: [],
[suppressionProviderFactory]);
var document = GetDocumentAndSelectSpan(workspace, out var span);
var diagnostics = await diagnosticService.GetDiagnosticsForSpanAsync(document, span, CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,7 @@ private async Task<ImmutableArray<CodeActionOperation>> GetGenerateIntoExistingD
{
string includeUsingsOrImports = null;
if (!areFoldersValidIdentifiers)
{
folders = SpecializedCollections.EmptyList<string>();
}
folders = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This appears to be a new allocation


// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This appears to be a new allocation


var builder = new List<SymbolDisplayPart>();
builder.AddLineBreak();
Expand Down