Skip to content

[PrintAsObjC] More tweaks to +new unavailability #13422

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
Dec 14, 2017

Conversation

jrose-apple
Copy link
Contributor

Another follow-up to #12295. Downgrades +new unavailability to deprecation in pre-Swift-5 modes. The general policy has been that even if something crashes at run time, we don't make it a hard error in Swift 4 mode (or Swift 3 mode!) if it wasn't a hard error in Swift 4.0 (3.0). In this case, we thought we could get away with it, and then it turns out it actually caused some problems. (And as #13320 shows, we can still make mistakes.)

This change isn't perfect because the diagnostic appears in clients rather than in the module that's being compiled as Swift 4 (instead of Swift 5). But it still means that someone who hasn't changed anything from a valid Swift 4.0 project will be able to compile without any changes, even if they were relying on being able to call +new when -init was unavailable for some reason.

Finally, include a message when making +new unavailable / deprecated. We've seen a few people run into this and not know what changed.

rdar://problem/35942058

Another follow-up to 49c65fa. We've seen a few people run into
this and not know what changed.

rdar://problem/35942058
The general policy has been that even if something crashes at run
time, we don't make it a hard error in Swift 4 mode (or Swift 3 mode!)
if it wasn't a hard error in Swift 4.0 (3.0). In this case, we thought
we could get away with it, and then it turns out it actually caused
some problems. (And as 2bc0106 shows, we can still make mistakes.)

This change isn't perfect because the diagnostic appears in /clients/
rather than in the module that's being compiled as Swift 4 (instead of
Swift 5). But it still means that someone who hasn't changed
/anything/ from a valid Swift 4.0 project will be able to compile
without any changes, even if they were relying on being able to call
+new when -init was unavailable for some reason.

More rdar://problem/35942058
@jrose-apple
Copy link
Contributor Author

@JaviSoto, @DougGregor, what do you think of this one? I think we got the most important change already, but this might still improve the state of the world.

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test macOS

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@JaviSoto
Copy link
Contributor

I love the idea of the explicit error message. The policy for avoiding breaking changes is totally fair too.
Sorry for breaking so many things :( I definitely learned a lot from this one!

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.

LGTM

@jrose-apple jrose-apple merged commit 0d5d128 into swiftlang:master Dec 14, 2017
@jrose-apple jrose-apple deleted the newer-and-improveder branch December 14, 2017 16:53
@jrose-apple
Copy link
Contributor Author

Don't stress about it, Javi. It was listed as a starter bug and none of us thought too deeply about it either. That's the reviewer's responsibility more than a spare-time contributor's! We're still in a better place for you adding this. :-)

jrose-apple added a commit to jrose-apple/swift that referenced this pull request Dec 14, 2017
[PrintAsObjC] More tweaks to +new unavailability

rdar://problem/35942058
@JaviSoto
Copy link
Contributor

Thank you Jordan <3

jrose-apple added a commit that referenced this pull request Dec 14, 2017
…#13433)

[PrintAsObjC] More tweaks to +new unavailability

rdar://problem/35942058
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.

3 participants