-
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
Avoid boxing when structs are used as collection keys. #69443
Changes from all commits
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 |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
using System.Diagnostics; | ||
using System.Reflection.Metadata; | ||
using System.Reflection.Metadata.Ecma335; | ||
using Microsoft.CodeAnalysis.Text; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.FindSymbols | ||
|
@@ -63,11 +62,11 @@ private string GetDebuggerDisplay() | |
=> Name + ", " + ParentIndex; | ||
} | ||
|
||
private readonly struct ParameterTypeInfo(string name, bool isComplex, bool isArray) | ||
private readonly record struct ParameterTypeInfo(string name, bool isComplex, bool isArray) | ||
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. ❓ Why is this one changing? 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. ➡️ This type isn't used as a dictionary key, but rather as a dictionary value in a type that happens to create a set from the values. |
||
{ | ||
/// <summary> | ||
/// This is the type name of the parameter when <see cref="IsComplexType"/> is false. | ||
/// For array types, this is just the elemtent type name. | ||
/// For array types, this is just the element type name. | ||
/// e.g. `int` for `int[][,]` | ||
/// </summary> | ||
public readonly string Name = name; | ||
|
@@ -96,11 +95,11 @@ private readonly struct ParameterTypeInfo(string name, bool isComplex, bool isAr | |
public readonly bool IsComplexType = isComplex; | ||
} | ||
|
||
public readonly struct ExtensionMethodInfo(string fullyQualifiedContainerName, string name) | ||
public readonly record struct ExtensionMethodInfo(string fullyQualifiedContainerName, string name) | ||
{ | ||
/// <summary> | ||
/// Name of the extension method. | ||
/// This can be used to retrive corresponding symbols via <see cref="INamespaceOrTypeSymbol.GetMembers(string)"/> | ||
/// This can be used to retrieve corresponding symbols via <see cref="INamespaceOrTypeSymbol.GetMembers(string)"/> | ||
/// </summary> | ||
public readonly string Name = name; | ||
|
||
|
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.
❓ Why is this one changing?
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.
➡️ This type isn't used as a dictionary key, but rather as a dictionary value in a type that happens to create a set from the values.