swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-13492] Make StrideTo and StrideThrough conform to (RandomAccess)Collection

Open swift-ci opened this issue 5 years ago • 4 comments

Previous ID SR-13492
Radar rdar://problem/68295652
Original Reporter CTMacUser (JIRA User)
Type Improvement

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement
Assignee None
Priority Medium

md5: 6f660515240d7cc3dce35125895253ea

Issue Description:

These types only conform to Sequence, instead of Collection, due to SR-6474. Since that bug is now fixed, can we add the conformance now?

swift-ci avatar Sep 03 '20 19:09 swift-ci

@swift-ci create

typesanitizer avatar Sep 03 '20 20:09 typesanitizer

Comment by Kyle Macomber (JIRA)

This will require the ability to annotate protocol conformances with availability before we can land it.

swift-ci avatar Sep 03 '20 22:09 swift-ci

Is there any way to push this? With swift-testing, this would be a welcome addition, as test arguments must be collections. With this conformance, we could pass strides directly:

@Test(arguments: stride(from: 9.0, through: 24, by: 2.5))
func testWithSizes(size: Double) { … }

As of Xcode 16 beta 4 this is an error.

macguru avatar Jul 26 '24 15:07 macguru

This is more subtle than it seems at first, see https://github.com/swiftlang/swift/pull/13022 for some discussion.

stephentyrone avatar Jul 29 '24 19:07 stephentyrone