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-1767] Compiler should apply optionalization to framework API whose nullability changes, in statements like conditional binding #44376

Closed
an0 mannequin opened this issue Jun 15, 2016 · 1 comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation will not do Resolution: Will not be worked on

Comments

@an0
Copy link
Mannequin

an0 mannequin commented Jun 15, 2016

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

md5: 9b55d5caf01827600c2469eb857918d6

Issue Description:

When nullability of framework API changes client code has a hard time to reconcile the conflict if it still needs to support old SDK, which happens during OS update like now iOS 9 -> iOS 10 because developers need to update code to new SDK asap but still have to use current version of Xcode to submit apps to the App Store.

Example:
The returning type of CIContext.createCGImage changes from CGImage to CGImage?.

Discussion:
https://twitter.com/an0/status/742859080176373760

@belkadan
Copy link
Contributor

The usual workaround is this, which works on the old and new SDKs:

let wrapped: Optional = …
guard let image = wrapped else { … }

I think that's simple enough that we don't need a special feature.

(Hopefully also we'll have fewer nullability changes in the future; it's not really sound to change between releases unless the old annotation was incorrect.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler in itself feature A feature request or implementation will not do Resolution: Will not be worked on and removed new feature labels Nov 15, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation will not do Resolution: Will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants