-
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 Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
| Previous ID | SR-13815 |
| Radar | rdar://problem/71082108 |
| Original Reporter | iDevid (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 1 |
| Component/s | Compiler |
| Labels | Bug, DiagnosticsQoI, TypeChecker |
| Assignee | iDevid (JIRA) |
| Priority | Medium |
md5: 790bfd0e832f8f87224b0af0f4e3cd77
is duplicated by:
- SR-13842 Compiler fails to type check optional UIImage when
SwiftUIis imported
Issue Description:
struct Object {
init?() {
return nil
}
}
struct Test {
let id: Int
let object: Object?
}
Test(id: 1, object: nil)
Test(id: 1, object: Object())
Test(id: 1, object: .init()) // this will failAs you can see, the Test Struct contains an id along with an optional Object property.
Passing the Object's .init() in the Test initializer will lead to the error:
Value of optional type 'Object?' must be unwrapped to a value of type 'Object'This diagnostic doesn't make it clear what the issue is.
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 Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis