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

Partial properties: duplicate membersByName before merging accessors #74969

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

cston
Copy link
Member

@cston cston commented Aug 31, 2024

Duplicate membersByName dictionary before modifying in mergeAccessors if the dictionary is cached.

Note, the potential race condition is speculative. I'm not aware of a reported issue, and I have not been able to create a test that hits an issue here.

Relates to test plan #73090

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 31, 2024
membersByName = new Dictionary<ReadOnlyMemory<char>, ImmutableArray<Symbol>>(membersByName, ReadOnlyMemoryOfCharComparer.Instance);
}

DuplicateMembersByNameIfCached(ref membersByName);
Copy link
Member Author

@cston cston Aug 31, 2024

Choose a reason for hiding this comment

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

Previously, membersByName was modified in mergeAccessors before duplicating.

@cston cston marked this pull request as ready for review August 31, 2024 21:04
@cston cston requested a review from a team as a code owner August 31, 2024 21:04
@cston cston requested a review from RikkiGibson August 31, 2024 21:04
@RikkiGibson RikkiGibson self-assigned this Sep 3, 2024
membersByName[name] = FixPartialMember(membersByName[name], prevProperty, currentProperty);
}

void mergeAccessors(ref Dictionary<ReadOnlyMemory<char>, ImmutableArray<Symbol>> membersByName, ReadOnlyMemory<char> name, SourcePropertyAccessorSymbol? currentAccessor, SourcePropertyAccessorSymbol? prevAccessor)
void mergeAccessors(ref Dictionary<ReadOnlyMemory<char>, ImmutableArray<Symbol>> membersByName, SourcePropertyAccessorSymbol? currentAccessor, SourcePropertyAccessorSymbol? prevAccessor)
Copy link
Contributor

Choose a reason for hiding this comment

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

It also seems like this function could take membersByName by value instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Feature - Partial Properties untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants