-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[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
[PrintAsObjC] More tweaks to +new unavailability #13422
Conversation
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
@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. |
@swift-ci Please test macOS |
@swift-ci Please smoke test Linux |
I love the idea of the explicit error message. The policy for avoiding breaking changes is totally fair too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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. :-) |
[PrintAsObjC] More tweaks to +new unavailability rdar://problem/35942058
Thank you Jordan <3 |
…#13433) [PrintAsObjC] More tweaks to +new unavailability rdar://problem/35942058
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