-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationimprovementtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-12063 |
Radar | None |
Original Reporter | @keith |
Type | Improvement |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Improvement, DiagnosticsQoI, TypeChecker |
Assignee | @theblixguy |
Priority | Medium |
md5: 17a3bec14e602d0feaaa8c2f85e8aae7
Issue Description:
With this code:
enum Foo {
case bar
case none
}
let a: Foo? = Foo.none
switch a {
case .none: // Should be '.none?'
print(".none")
case .bar:
print(".bar")
default:
print("default")
}
Everything compiles, but you may have surprising behavior where the `default` case is matched instead of `case .none`.
Following by the example of the great warning you get when you have `let a: Foo? = .none`, it would be great if there was a similar warning for the "ambiguity" here
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationimprovementtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis