-
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 newcomers
Description
| Previous ID | SR-9201 |
| Radar | None |
| Original Reporter | @bjhomer |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Swift 4.2
Swift 5 (master, as of Nov 6, 2018)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, DiagnosticsQoI, StarterBug |
| Assignee | @bjhomer |
| Priority | Medium |
md5: c734879d228c03881746c3e4d483304a
Issue Description:
An incorrect error message is produced here:
struct Thing {
func produceDoubleOptional() -> Int?? { return 3 }
}
let optThing: Thing? = Thing()
// error: Value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let _: Int? = optThing?.produceDoubleOptional()The error is suggesting a change like this:
let _: Int? = (optThing?.produceDoubleOptional())!But
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 newcomers