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

[SR-1215] Provide both Swift 2.2 and Swift 3 APIs for corelibs-xctest? #390

Closed
modocache mannequin opened this issue Apr 12, 2016 · 3 comments
Closed

[SR-1215] Provide both Swift 2.2 and Swift 3 APIs for corelibs-xctest? #390

modocache mannequin opened this issue Apr 12, 2016 · 3 comments
Assignees

Comments

@modocache
Copy link
Mannequin

modocache mannequin commented Apr 12, 2016

Previous ID SR-1215
Radar None
Original Reporter @modocache
Type New Feature
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s XCTest
Labels New Feature
Assignee @modocache
Priority Medium

md5: c552ac518ced1233d8124027dfeee90b

Issue Description:

The current APIs match Swift 3, but not Swift 2.2. For early adopters, this causes some pain: Kitura/Kitura#349 (comment)

Perhaps we should provide both APIs for the time being? Or could we check the current version of the Swift compiler being used, and provide either 2.2-/3.0-compatible APIs?

@briancroom
Copy link
Collaborator

I'm intrigued by the idea of supporting both API versions in corelibs-xctest, but I'm thinking that it really isn't very feasible. Wouldn't that mean that the entire framework would need to be buildable by both the Swift 2.2 and 3 compilers, because binary distribution isn't possible? And not only corelibs-xctest, but also corelibs-foundation?

I'm wondering if I'm misunderstanding the approach that you are suggesting here @modocache?

@modocache
Copy link
Mannequin Author

modocache mannequin commented Apr 29, 2016

I was wondering whether we could use the compile-time Swift version checks from Swift 2.2+ to write something like this:

#if swift(>=3.0)
public func expectation(withDescription description: String, file: StaticString = #file, line: UInt = #line) -> XCTestExpectation {
#else
public func expectationWithDescription(description: String, file: StaticString = #file, line: UInt = #line) -> XCTestExpectation {
#endif
    // ...implementation code.
}

But now that you mention it, I think you're right: I guess this isn't feasible. It isn't just a matter of the APIs--as you pointed out, it's also a matter of being able to compile the corelibs-xctest code on two versions of Swift. That's too much of a burden to seriously consider.

Thanks for pointing that out! Closing this.

@briancroom
Copy link
Collaborator

I do like this line of thinking though, and I'm optimistic that once we have the major breaking changes of Swift 3 behind us that it will get easier to maintain broader version support in libraries!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant