Skip to content

[swift-3.1-branch][SDK] Turn URLError.Code back into an enum #7695

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

Merged
merged 2 commits into from
Feb 23, 2017

Conversation

lilyball
Copy link
Contributor

Explanation

This PR reverts #7650 and instead just fixes the missing/broken case.

Unfortunately we can't use availability attributes on 4 of the 5 cases, because apparently the build fails if any enum variant is declared that isn't available on macOS 10.9.

Scope

This fixes the accidental source breakage from #7650. Adding the new variants is technically source-breaking for any code that has an exhaustive switch over cases, but such code is broken anyway and we can't just omit error codes.

SR Issue

Resolves SR-4035.

Risk

Low.

Testing

Nothing beyond the pre-existing tests for URLError.

…t_cases"

This reverts commit 8654428, reversing
changes made to 51795d3.
`URLError.Code` was missing 2 cases, and had 3 more cases implemented as
static properties that would crash when accessed.

Due to a limitation in the build process, we can't add availability
attributes for enum variants past macOS 10.9. This means 4 of the 5
cases are missing availability attributes that they should have.
@lilyball
Copy link
Contributor Author

@swift-ci Please test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best balance we can achieve for 3.1---it eliminates the run-time crash by adding the cases, but without breaking existing source code.

@DougGregor DougGregor added this to the Swift 3.1 milestone Feb 22, 2017
@tkremenek tkremenek merged commit 584dbda into swiftlang:swift-3.1-branch Feb 23, 2017
@lilyball lilyball deleted the urlerror_enum branch March 1, 2017 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants