-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Make mutable generic collection interfaces implement read-only collection interfaces #95830
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9f3d848
Make mutable generic collection interfaces implement read-only collec…
TylerBrinkley df31e3b
More updates
TylerBrinkley e2c9b7c
Fix build
TylerBrinkley 4e81afc
Update refs
TylerBrinkley 2a873e5
Add DIM's to ref also
TylerBrinkley a7d4cbf
fixes
TylerBrinkley 5089b36
Try to fix arrays
TylerBrinkley 27c9fe6
Moved dim's to the end of the interfaces. Made the tests support .NET…
TylerBrinkley b3f7aae
Small fix
TylerBrinkley 27c5fdf
Small fix
TylerBrinkley 140f43b
Fix build
TylerBrinkley 888eb0b
Fix
TylerBrinkley f701940
Cleanup
TylerBrinkley 6be8e51
Merge branch 'main' into issue-31001
eiriktsarpalis 0580aae
Incorporate #96672
TylerBrinkley de36206
Merge branch 'main' into issue-31001
TylerBrinkley 25a6a93
Merge remote-tracking branch 'dotnet/main' into issue-31001
tannergooding 79fff71
Check the correct inheritanceDepth in vm/array.cpp
tannergooding 11d49dd
Merge branch 'main' into issue-31001
tannergooding 68c768d
Merge branch 'main' into issue-31001
eiriktsarpalis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
inheritanceDepth != 0?My understanding is that previously we had:
IList<T> -> ICollection<T> -> IEnumerable<T> -> IEnumerableIReadOnlyList<T> -> IReadOnlyCollection<T> -> IEnumerable<T> -> IEnumerableSo in both cases we have a maximum inheritance depth of
4. We then subtract one so that we're effectively ignoring the existence ofIEnumerable, since this is only being used for the synthesized generic interfaces.Since we're still subtracting 1 from the depth above, we want to check against
0to preserve the optimization.In the new world, we have:
So
IEnumerable,IEnumerable<T>,IReadOnlyCollection<T>, andIReadOnlyList<T>should remain at-1,0,1, and2respectively (after the adjustment we're doing on L1214).While
ICollection<T>has had its adjusted depth bumped by 1 from1to2, sharing the slot withIReadOnlyList<T>. Similarly,IList<T>has been bumped from2to3remaining a unique slot.Thus, the lookup optimization can be preserved for any slot other than
2whereICollection<T>andIReadOnlyList<T>need something additional to disambiguate them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed up the one line fix here. Tests looked to generally be passing locally with it resolved.
I think we could add back in the lookup optimization as well, but left that out.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.