Skip to content

Simplifications to help moving rename entirely OOP.#43573

Merged
CyrusNajmabadi merged 15 commits intodotnet:masterfrom
CyrusNajmabadi:renameOOP5
Apr 23, 2020
Merged

Simplifications to help moving rename entirely OOP.#43573
CyrusNajmabadi merged 15 commits intodotnet:masterfrom
CyrusNajmabadi:renameOOP5

Conversation

@CyrusNajmabadi
Copy link
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 22, 2020

Overall plan it to make ConflictResolution a mutable internal type, but then expose an immutable snapshot of the final form with the data that clients actually need.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 22, 2020 21:11
@tmat
Copy link
Member

tmat commented Apr 23, 2020

I did a high-level review but I don't have much insight into how rename works. So someone who has should provide a detailed review.

@CyrusNajmabadi CyrusNajmabadi requested a review from tmat April 23, 2020 17:37
hashCode = hashCode * -1521134295 + IsReference.GetHashCode();
hashCode = hashCode * -1521134295 + EqualityComparer<DocumentId>.Default.GetHashCode(DocumentId);
hashCode = hashCode * -1521134295 + ComplexifiedTargetSpan.GetHashCode();
return hashCode;
Copy link
Member

Choose a reason for hiding this comment

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

Use Hash.Combine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i can't. not vailable on netstandard.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. i can do that in a followup.

Note: the benefit of the above approach is that the IDE detects it and will offer to upgrade it once you do have access to System.HashCode.


// List of All the Locations that were renamed and conflict-complexified
private readonly List<RelatedLocation> _relatedLocations;
public readonly List<RelatedLocation> RelatedLocations;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be exposed in an immutable way? Even if they can't set the list instance, they can modify the contents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no. this is actually mutate by callers. MutableConflictResolution is intended to be mutable. it changes as we're doing conflict resolution. At hte end though we snap the final immutbale state and pass that back out.

@ryzngard
Copy link
Contributor

Not worth blocking, but I find the naming a little confusing. I'd rather see ImmutableConflictResolution and ConflictResolution than ConflictResolution and MutableConflictResolution

Copy link
Contributor

@dpoeschl dpoeschl left a comment

Choose a reason for hiding this comment

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

LGTM, but the various follow-up tasks do seem like good ideas. :)

@CyrusNajmabadi CyrusNajmabadi merged commit d4bf699 into dotnet:master Apr 23, 2020
@ghost ghost added this to the Next milestone Apr 23, 2020
@CyrusNajmabadi
Copy link
Contributor Author

Thanks!

@CyrusNajmabadi CyrusNajmabadi deleted the renameOOP5 branch April 23, 2020 21:24
@sharwell sharwell modified the milestones: Next, temp, 16.7.P1 Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants