-
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
Test plan followup #44257
Test plan followup #44257
Changes from 6 commits
6b6689f
cae7f81
8c9f326
5d5dcc5
3f94e67
447d87f
3d33fe4
3f827dd
ed27295
232b02e
b8418fb
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 |
---|---|---|
|
@@ -99,7 +99,7 @@ internal class MemberSignatureComparer : IEqualityComparer<Symbol> | |
considerTypeConstraints: false, | ||
considerCallingConvention: false, | ||
considerRefKindDifferences: false, | ||
typeComparison: TypeCompareKind.AllIgnoreOptions); //shouldn't actually matter for source members | ||
typeComparison: TypeCompareKind.AllIgnoreOptions); | ||
|
||
/// <summary> | ||
/// This instance is used to determine if a partial method implementation matches the definition. | ||
|
@@ -313,6 +313,10 @@ private MemberSignatureComparer( | |
_considerCallingConvention = considerCallingConvention; | ||
_considerRefKindDifferences = considerRefKindDifferences; | ||
_typeComparison = typeComparison; | ||
if (!considerRefKindDifferences) | ||
{ | ||
_typeComparison |= TypeCompareKind.FunctionPointerRefMatchesOutInRefReadonly; | ||
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.
Can we assert that this option is never set on entry? #Closed 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 could, but I'm not sure what invariant that would be trying to preserve? Could you elaborate on what type of bug you think that would catch? In reply to: 426087571 [](ancestors = 426087571) 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.
From reviewing the change, I assumed that In reply to: 426889306 [](ancestors = 426889306,426087571) |
||
} | ||
} | ||
|
||
#region IEqualityComparer<Symbol> Members | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,8 @@ internal static TypeSymbol CopyTypeCustomModifiers(TypeSymbol sourceType, TypeSy | |
|
||
Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); // Same custom modifiers as source type. | ||
|
||
Debug.Assert(resultType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)); // Same object/dynamic, nullability and tuple names as destination type. | ||
// Same object/dynamic, nullability and tuple names as destination type. | ||
Debug.Assert(resultType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNativeIntegers)); | ||
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 doesn't feel right. Native int types specified in source should be preserved. #Closed 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. 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. It sounds like a bug. Please log an issue, thanks. In reply to: 426823520 [](ancestors = 426823520,426089925) 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. 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. Removed the flag and skipped the relevant test. In reply to: 426894790 [](ancestors = 426894790,426836636,426823520,426089925) |
||
|
||
return resultType; | ||
} | ||
|
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 so complicated? It looks like MemberSignatureComparer simply does
(refKind1 == RefKind.None) == (refKind2 == RefKind.None)
#ClosedThere 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.
I found this significantly more readable than the version in
MemberSignatureComparer
.In reply to: 426089324 [](ancestors = 426089324)
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.
I spent significant amount of time trying to figure out your intent here (time I could have spent elsewhere) and whether all the right combinations are handled and handled properly. Every reader will have to go through the same trouble over and over again. I understand your desire to use switch expressions everywhere you can, but in this case, I believe it makes code less clear and unnecessarily complicated. Please use simplified form of the check, especially that we are already using it elsewhere.
In reply to: 426821892 [](ancestors = 426821892,426089324)
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.
To be clear, that is not the motivation.
And I spent probably a similar amount of time creating a truth table in my head for the original check to be sure that I could understand what it was checking. I used this form because I genuinely find it significantly easier to read. I don't find the other form simpler in any fashion.
In reply to: 426825848 [](ancestors = 426825848,426821892,426089324)
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.
I'll change this. However, I want to be clear that I don't just use new features for the fun of it. I use them when it would help me to read the code better, and I find that writing out the truth table (as I can do concisely here with a switch expression) is significantly easier to understand. I'll change this because we have prior art in the form of a comparison, but in future code that does similar things I'm still going to prefer using the form I understand more easily.
In reply to: 426840351 [](ancestors = 426840351,426825848,426821892,426089324)