Skip to content

Commit 1de0a04

Browse files
committed
Avoid needing _parameterizedProtocolsAPI
1 parent bbc79a9 commit 1de0a04

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Package.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ extension Array where Element == PackageDescription.SwiftSetting {
150150
.enableExperimentalFeature("AvailabilityMacro=_clockAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0"),
151151
.enableExperimentalFeature("AvailabilityMacro=_regexAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0"),
152152
.enableExperimentalFeature("AvailabilityMacro=_swiftVersionAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0"),
153-
.enableExperimentalFeature("AvailabilityMacro=_parameterizedProtocolsAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0"),
154153
.enableExperimentalFeature("AvailabilityMacro=_typedThrowsAPI:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0"),
155154

156155
.enableExperimentalFeature("AvailabilityMacro=_distantFuture:macOS 99.0, iOS 99.0, watchOS 99.0, tvOS 99.0, visionOS 99.0"),

Sources/Testing/Issues/Issue.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ extension Issue: CustomStringConvertible, CustomDebugStringConvertible {
170170
}
171171
}
172172

173+
/// An empty protocol defining a type that conforms to `RangeExpression<Int>`.
174+
///
175+
/// In the future, when our minimum deployment target supports casting a value
176+
/// to a constrained existential type ([SE-0353](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0353-constrained-existential-types.md#effect-on-abi-stability)),
177+
/// we can remove this protocol and cast to `RangeExpression<Int>` instead.
178+
private protocol _RangeExpressionOverIntValues: RangeExpression where Bound == Int {}
179+
extension ClosedRange<Int>: _RangeExpressionOverIntValues {}
180+
extension PartialRangeFrom<Int>: _RangeExpressionOverIntValues {}
181+
extension PartialRangeThrough<Int>: _RangeExpressionOverIntValues {}
182+
extension PartialRangeUpTo<Int>: _RangeExpressionOverIntValues {}
183+
extension Range<Int>: _RangeExpressionOverIntValues {}
184+
173185
extension Issue.Kind: CustomStringConvertible {
174186
public var description: String {
175187
switch self {
@@ -187,7 +199,7 @@ extension Issue.Kind: CustomStringConvertible {
187199
"Expectation failed: \(expectation.evaluatedExpression.expandedDescription())"
188200
}
189201
case let .confirmationMiscounted(actual: actual, expected: expected):
190-
if #available(_parameterizedProtocolsAPI, *), let expected = expected as? any RangeExpression<Int> {
202+
if let expected = expected as? any _RangeExpressionOverIntValues {
191203
let expected = expected.relative(to: [])
192204
if expected.upperBound > expected.lowerBound && expected.lowerBound == expected.upperBound - 1 {
193205
return "Confirmation was confirmed \(actual.counting("time")), but expected to be confirmed \(expected.lowerBound.counting("time"))"

cmake/modules/shared/AvailabilityDefinitions.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ add_compile_options(
1313
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_clockAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0\">"
1414
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_regexAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0\">"
1515
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_swiftVersionAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0\">"
16-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_parameterizedProtocolsAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0\">"
1716
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_typedThrowsAPI:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0\">"
1817
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -define-availability -Xfrontend \"_distantFuture:macOS 99.0, iOS 99.0, watchOS 99.0, tvOS 99.0, visionOS 99.0\">")

0 commit comments

Comments
 (0)