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

[stdlib] Preserve random-access Mirror.children inside AnyCollection #33319

Closed

Conversation

airspeedswift
Copy link
Member

#32041 unintentionally lost the random-access nature of some collections. While the returned type is AnyCollection, you could restore random-access via AnyRandomAccessCollection(mirror.children), but this now returned nil for some children. This PR restores this.

@airspeedswift
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 5, 2020

Build failed
Swift Test OS X Platform
Git Sha - b696c39156fda8d4b5b5a5d22393f25be1ea933c

@swift-ci
Copy link
Contributor

swift-ci commented Aug 5, 2020

Build failed
Swift Test Linux Platform
Git Sha - b696c39156fda8d4b5b5a5d22393f25be1ea933c

@airspeedswift
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 5, 2020

Build failed
Swift Test Linux Platform
Git Sha - b696c39156fda8d4b5b5a5d22393f25be1ea933c

@swift-ci
Copy link
Contributor

swift-ci commented Aug 5, 2020

Build failed
Swift Test OS X Platform
Git Sha - b696c39156fda8d4b5b5a5d22393f25be1ea933c

@airspeedswift
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 6, 2020

Build failed
Swift Test OS X Platform
Git Sha - ca2f68dee149cd14e2be9562d1e15f61af8b4190

@swift-ci
Copy link
Contributor

swift-ci commented Aug 6, 2020

Build failed
Swift Test Linux Platform
Git Sha - ca2f68dee149cd14e2be9562d1e15f61af8b4190

let c2 = AnyRandomAccessCollection(m2.children)
expectNotNil(c2)
expectTrue(c2?.first?.label == "i")
expectTrue(c2?.first?.label as? Int == 42)

Choose a reason for hiding this comment

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

Shouldn't this be expectTrue(c2?.first?.value as? Int == 42)?

let c1 = AnyRandomAccessCollection(m1.children)
expectNotNil(c1)
expectNil(c1?.first?.label)
expectTrue(c1?.first?.label as? Int == 1)

Choose a reason for hiding this comment

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

Shouldn't this be expectTrue(c1?.first?.value as? Int == 1)?

@HoustonDuane
Copy link

HoustonDuane commented Aug 18, 2020

@airspeedswift Hi, please review my comments regarding the two arguably copy&paste induced errors 🧐

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

@shahmishal shahmishal closed this Oct 5, 2020
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.

4 participants