Skip to content

Fix well-known Equals method nullable analysis bug#41918

Merged
RikkiGibson merged 16 commits intodotnet:masterfrom
RikkiGibson:nullable-equalsmethod-fix
Mar 16, 2020
Merged

Fix well-known Equals method nullable analysis bug#41918
RikkiGibson merged 16 commits intodotnet:masterfrom
RikkiGibson:nullable-equalsmethod-fix

Conversation

@RikkiGibson
Copy link
Copy Markdown
Member

@RikkiGibson RikkiGibson commented Feb 25, 2020

Closes #40577

I wrongly assumed that a method that implements e.g. IEquatable.Equals would be contained in a class that implements IEquatable.

edit: among other wrong assumptions! This PR has been a journey into how interfaces actually work/what's possible in .NET.

@RikkiGibson RikkiGibson added this to the 16.6 milestone Feb 25, 2020
@RikkiGibson RikkiGibson requested a review from a team as a code owner February 25, 2020 01:45
@RikkiGibson RikkiGibson changed the title Fix well-known Equals method bug Fix well-known Equals method nullable analysis bug Feb 25, 2020
@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Feb 25, 2020

            foreach (var member in constructedType.GetMembers(WellKnownMemberNames.ObjectEquals))

We have a helper for this - AsMemberOfType #Closed


Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:3780 in d754534. [](commit_id = d754534, deletion_comment = False)

@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Feb 25, 2020

Done with review pass (iteration 1) #Closed

Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Feb 26, 2020

Done with review pass (iteration 5) #Closed

Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
@RikkiGibson RikkiGibson added the PR For Personal Review Only The PR doesn’t require anyone other than the developer to review it. label Mar 4, 2020
@RikkiGibson
Copy link
Copy Markdown
Member Author

Temporarily marking for personal review so I can start working on the WIP on another machine.

Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Mar 10, 2020

Done with review pass (iteration 8) #Closed

Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Mar 10, 2020

Done with review pass (iteration 11) #Closed

Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
Comment thread src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs Outdated
@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Mar 12, 2020

Done with review pass (iteration 14) #Closed

@AlekseyTs
Copy link
Copy Markdown
Contributor

AlekseyTs commented Mar 12, 2020

@RikkiGibson It looks like CI jobs are timing out. Could that be related to the last commit? #Closed

Copy link
Copy Markdown
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (iteration 16)

@RikkiGibson RikkiGibson requested a review from a team March 13, 2020 18:26
@RikkiGibson
Copy link
Copy Markdown
Member Author

@dotnet/roslyn-compiler Please review

@RikkiGibson RikkiGibson merged commit efc067e into dotnet:master Mar 16, 2020
@ghost ghost modified the milestones: 16.6, Next Mar 16, 2020
@RikkiGibson RikkiGibson deleted the nullable-equalsmethod-fix branch March 16, 2020 23:53
@sharwell sharwell modified the milestones: Next, 16.6.P2 Mar 17, 2020
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.

Roslyn doesn't consider quasi-implemenations of IEqualityComparer.Equals and IEqutable.Equals as well known members in nullability analysis

4 participants