-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixed TimeZone.init(secondsFromGMT:) failability #1142
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
Conversation
I think this should be failable? https://developer.apple.com/documentation/foundation/timezone/2293718-init |
@ianpartridge Ah, you're right. Let's keep it consistent. I don't understand why it should be failable though. Do you? |
No I don't know, sorry. Possibly there's a difference in the implementation on Darwin which means it might fail. |
|
Here's the relevant line from the Darwin implementation:
|
Ah, interesting. Now I see that also let tz = TimeZone(secondsFromGMT: 99999999)
tz == nil // false
// And subsequent usage of tz throws exceptions I assume that's something that needs to be resolved, right? |
I'm reopening this with a half-way solution. I'm not sure if it's possible to work around not failable The least we can do I guess, is making @ianpartridge @parkera please let me know if my reasoning is correct here. |
@parkera should we open a Radar if |
So basically, This is something that I think I realized when writing the For now, for source compatibility, the proposed patch makes sense to me. |
And yah, if a radar is filed I can track it -- although frankly I want people to use the struct type here and not the ref type. :) |
@parkera Radar 33650342 raised for the incorrect nullable annotation on |
@swift-ci please test and merge |
TimeZone.init(secondsFromGMT:)
made not failable.Aligns with https://developer.apple.com/documentation/foundation/nstimezone/1387199-initFixed
TimeZone.init(secondsFromGMT:)
failability