-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Closed
Copy link
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 itself
Description
Previous ID | SR-5279 |
Radar | None |
Original Reporter | ngocluu (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: b30a833a82198122297db51fd5b0c3da
is duplicated by:
- SR-5321 Case Exhaustion Check Bug
Issue Description:
Xcode 9 beta 2 (9M137d)
enum Kind {
case first(a: Int?, b: Int?, c: Int?, d: Int?, e: Int?, f: Bool?)
case second(a: Int?, b: Int?, c: Int?, d: Int?, e: Bool?)
var name: String {
switch self {
case .first:
return "first"
case .second:
return "second"
}
}
}
Adding default
case shows warning: "Default will never be executed".
Workaround:
var name: String {
switch self {
case .first(_):
return "first"
case .second(_):
return "second"
}
}
This worked in Xcode 9 beta 1.
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 itself