-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
@swift-ci please test |
Build failed |
Build failed |
b696c39
to
ca2f68d
Compare
@swift-ci please test |
Build failed |
Build failed |
ca2f68d
to
83de1b5
Compare
@swift-ci please test |
Build failed |
Build failed |
let c2 = AnyRandomAccessCollection(m2.children) | ||
expectNotNil(c2) | ||
expectTrue(c2?.first?.label == "i") | ||
expectTrue(c2?.first?.label as? Int == 42) |
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 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) |
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 expectTrue(c1?.first?.value as? Int == 1)?
@airspeedswift Hi, please review my comments regarding the two arguably copy&paste induced errors 🧐 |
#32041 unintentionally lost the random-access nature of some collections. While the returned type is
AnyCollection
, you could restore random-access viaAnyRandomAccessCollection(mirror.children)
, but this now returnednil
for some children. This PR restores this.