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-8920] DateFormatter warnings #3620

Closed
kevints mannequin opened this issue Oct 5, 2018 · 3 comments
Closed

[SR-8920] DateFormatter warnings #3620

kevints mannequin opened this issue Oct 5, 2018 · 3 comments

Comments

@kevints
Copy link
Mannequin

kevints mannequin commented Oct 5, 2018

Previous ID SR-8920
Radar None
Original Reporter @kevints
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 31de32e38aff0c3f8ea129b41214dc8e

Issue Description:

Foundation/DateFormatter.swift:224:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:224:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:224:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:238:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:238:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:238:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:252:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:252:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:252:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:267:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:267:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:267:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:281:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:281:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:281:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:321:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:321:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:321:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:335:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:335:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:335:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:349:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:349:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:349:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:363:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:363:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:363:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:377:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:377:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:377:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:391:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:391:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:391:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:405:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:405:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:405:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:419:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:419:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:419:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:433:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:433:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:433:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:447:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:447:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:447:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:461:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:461:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:461:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:475:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:475:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:475:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
Foundation/DateFormatter.swift:489:45: warning: treating a forced downcast to '[String]' as optional will never produce 'nil'
                return cfSymbols.allObjects as! [String]
                                            ^
Foundation/DateFormatter.swift:489:47: note: use 'as?' to perform a conditional downcast to '[String]'
                return cfSymbols.allObjects as! [String]
                                              ^
                                              ?
Foundation/DateFormatter.swift:489:24: note: add parentheses around the cast to silence this warning
                return cfSymbols.allObjects as! [String]
                       ^
                       (                                )
@belkadan
Copy link

belkadan commented Oct 5, 2018

I feel like we've had this come up before, about whether this warning is useful when the Optional is merely contextual. @rudkx, @xedin?

@xedin
Copy link
Member

xedin commented Oct 15, 2018

This looks like a behavior changes related to IUO being modeled as optionals, before this change examples like:

func foo(_ x: [Any]) -> [String]! {
  return x as! [String]
}

Didn't produce any warnings.

@spevans
Copy link
Collaborator

spevans commented Jun 20, 2020

This was fixed in #2292

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants