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

3.13.3 Regression - CollectionTally correctly handles ImmutableDictionary again #4097

Merged
merged 2 commits into from Apr 19, 2022

Conversation

stevenaw
Copy link
Member

Fixes #4095

Allows CollectionTally to work with ImmutableDictionary properly again by avoiding a bulk-add for the ICollection case

@@ -170,10 +170,8 @@ void TryRemoveSlow(IEnumerable c)

private static ArrayList ToArrayList(IEnumerable items)
{
if (items is ICollection ic)
return new ArrayList(ic);
var list = items is ICollection ic ? new ArrayList(ic.Count) : new ArrayList();
Copy link
Member Author

Choose a reason for hiding this comment

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

ImmutableDictionary.CopyTo will convert the underlying type which is why the ctor which took in an ICollection was failing, but we can at least initialize the ArrayList to the proper size if it is known

@stevenaw stevenaw added this to the 3.13.4 milestone Apr 15, 2022
Copy link
Member

@manfred-brands manfred-brands left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

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

LGTM.

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

Successfully merging this pull request may close these issues.

None yet

3 participants