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-7963] [4.2 Regression] Bool.toggle is not properly annotated with availability. #50498

Open
swift-ci opened this issue Jun 11, 2018 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7963
Radar None
Original Reporter andersha (JIRA User)
Type Bug
Environment

Xcode 10 beta 1
macOS 10.14 Mojave beta 1

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

md5: 80946a25b7c4bf92050eb1c29ad45e86

Issue Description:

`Bool.toggle` currently leaks into Swift 4.0 mode, breaking sources that have already extended `Bool` with such method. The `!swift(>=4.2)` directive does not help, and the `compiler` directive has not yet implemented.

The method should be annotated with `@available(swift, introduced: 4.2)` IMO.

@belkadan
Copy link
Contributor

cc @moiseev

@moiseev
Copy link
Mannequin

moiseev mannequin commented Jun 11, 2018

We cannot guarantee any source compatibility with the user code, so the fact that it breaks non-standard-library extensions is unfortunate, but is not something we will consider a source incompatibility. Making Bool.toggle() unconditionally available allows people to use it without needing to migrate their whole projects to Swift 4.2. /cc @airspeedswift

This is one of those problems that only arise when you're trying to build the same Xcode project without modifications with both shipping Xcode 9.X and Xcode 10 beta, for whatever reasons. One possible workaround can be to have 2 separate Xcode project files and collect all the clashing extensions in a separate Swift file. This extra file will be included in the Xcode 9 project but not the Xcode 10 project.

@moiseev
Copy link
Mannequin

moiseev mannequin commented Jun 12, 2018

Actually, in this case, you can mark your version of toggle as obsolete in Swift 4.2 and it should resolve the issue. Thanks Ben for the suggestion.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants