-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationgood first issueGood for newcomersGood for newcomersregressionswift 5.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
| Previous ID | SR-10199 |
| Radar | None |
| Original Reporter | murthyveda2000 (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, 5.0Regression, DiagnosticsQoI, StarterBug, TypeChecker |
| Assignee | @theblixguy |
| Priority | Medium |
md5: 4fa37f2df1e096a8d1e88933647f691e
Issue Description:
After upgrading to XCode 10.2 and converting to Swift 5, I am getting a ton of new warnings related to force unwrapped optionals.
Here is a very simple example, but I'm getting the example this error all over the place (especially for the first argument in NSLayoutContraint constructor).
If a property is defined as such:
@IBOutlet weak var shutterButton : UIButton! And then later I reference it as an Any:
var views : [Any] = []
views.append(shutterButton) // Expression implicitly coerced from 'UIButton?' to 'Any'I get the error which I put into the comment there.
Since shutterButter is actually a UIButton and not a UIButton?, I don't think I should be getting this warning and don't get this warning in Swift 4.2.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationgood first issueGood for newcomersGood for newcomersregressionswift 5.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis