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

Compare Nullable modifiers while comparing type symbols by default. #30770

Merged

Conversation

AlekseyTs
Copy link
Contributor

No description provided.

@AlekseyTs
Copy link
Contributor Author

Test windows_release_vs-integration_prtest please

@@ -2905,7 +2905,7 @@ private static void GetAllCandidates(Dictionary<TypeSymbolWithAnnotations, TypeS
{
candidates.Remove(candidate);
}
else if (bound.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames))
else if (bound.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
Copy link
Member

@333fred 333fred Oct 25, 2018

Choose a reason for hiding this comment

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

This seems to be used relatively often. Might be worth adding an explicit option in the enum. #Pending

@@ -512,7 +512,7 @@ public int GetHashCode(Symbol member)
}

if (_considerReturnType && member.GetMemberArity() == 0 &&
(_typeComparison & TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds) == 0) // If it is generic, then type argument might be in return type.
(_typeComparison & TypeCompareKind.AllIgnoreOptions) == 0) // If it is generic, then type argument might be in return type.
Copy link
Member

@333fred 333fred Oct 26, 2018

Choose a reason for hiding this comment

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

Isn't this ignoring new things besides nullability? Why the change? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this ignoring new things besides nullability? Why the change?

At this point I believe the change is necessary to ensure correctness because at the moment some implementations of GetHashCode on symbols actually sensitive to things that we are supposed to ignore. See #30673. I'll add a note to that issue that once we ensure that all GetHashCode implementations do the right thing, this condition probably can be removed.


In reply to: 228374243 [](ancestors = 228374243)

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 1)

@AlekseyTs
Copy link
Contributor Author

@cston Please review

@cston
Copy link
Member

cston commented Oct 26, 2018

    ConsiderEverything = 0, // Perhaps rename since this does not consider nullable modifiers.

Can be removed. #Pending


Refers to: src/Compilers/Core/Portable/Symbols/TypeCompareKind.cs:13 in d74070e. [](commit_id = d74070e, deletion_comment = False)


[Fact]
[WorkItem(30677, "https://github.com/dotnet/roslyn/issues/30677")]
public void TestErrorsImplementingGenericNestedInterfaces_Explicit_IncorrectPartialQualification()
Copy link
Member

@cston cston Oct 26, 2018

Choose a reason for hiding this comment

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

Incorrect [](start = 75, length = 9)

What does Incorrect refer to? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does Incorrect refer to?

This unit-test is a clone (possibly partial) of the other unit-test, the name is inherited from the original unit-test.


In reply to: 228689077 [](ancestors = 228689077)

@cston
Copy link
Member

cston commented Oct 26, 2018

Consider targeting master rather than features/NullableReferenceTypes.

@AlekseyTs
Copy link
Contributor Author

    ConsiderEverything = 0, // Perhaps rename since this does not consider nullable modifiers.

Can be removed.

I think it is used.


In reply to: 433565246 [](ancestors = 433565246)


Refers to: src/Compilers/Core/Portable/Symbols/TypeCompareKind.cs:13 in d74070e. [](commit_id = d74070e, deletion_comment = False)

@AlekseyTs AlekseyTs merged commit 2f8fefa into dotnet:features/NullableReferenceTypes Oct 29, 2018
@cston
Copy link
Member

cston commented Oct 29, 2018

    ConsiderEverything = 0, // Perhaps rename since this does not consider nullable modifiers.

Sorry, I was referring to the comment. I think the comment can be removed.


In reply to: 433985024 [](ancestors = 433985024,433565246)


Refers to: src/Compilers/Core/Portable/Symbols/TypeCompareKind.cs:13 in d74070e. [](commit_id = d74070e, deletion_comment = False)

@AlekseyTs
Copy link
Contributor Author

    ConsiderEverything = 0, // Perhaps rename since this does not consider nullable modifiers.

I was referring to the comment. I think the comment can be removed.

Sure. Thanks for the clarification. Will remove


In reply to: 433987578 [](ancestors = 433987578,433985024,433565246)


Refers to: src/Compilers/Core/Portable/Symbols/TypeCompareKind.cs:13 in d74070e. [](commit_id = d74070e, deletion_comment = False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants