[SR-12413] 5.2 regression: ClosedRange.Bound is no longer equivalent to ClosedRange.Element #54851
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
standard library
Area: Standard library umbrella
Attachment: Download
Environment
Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.3.0
Additional Detail from JIRA
md5: 57de20a533b6bdbf83615c11ea315b34
Issue Description:
In Swft 5.1, this compiles just fine:
But in Swift 5.2, these errors are shown:
The errors can be worked around by replacing Element with Bound in the original example. That's odd because Element is a typealias for Bound: https://developer.apple.com/documentation/swift/closedrange/element
That documentation says:
Available when Bound conforms to Strideable and Bound.Stride conforms to SignedInteger.
Not really sure what's going on here. I can understand why the compiler might prefer Bound over Element here (Element is really for the Sequence conformance) and I'm actually happier using Bound here. But I'm not sure why this has changed. I see nothing in the release notes suggesting this change. So I thought I might as well report it.
The text was updated successfully, but these errors were encountered: