-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
This program:
let x = switch 0 {
case 1: 1
case 2: false
case 3: ""
case 4: [1]
}
produces:
/Users/ovoorhees/Desktop/foo.swift:4:9: error: branches have mismatching types 'String' and '[Int]'
2 | case 1: 1
3 | case 2: false
4 | case 3: ""
| `- error: branches have mismatching types 'String' and '[Int]'
5 | case 4: [1]
6 | }
/Users/ovoorhees/Desktop/foo.swift:3:9: error: branches have mismatching types 'Bool' and '[Int]'
1 | let x = switch 0 {
2 | case 1: 1
3 | case 2: false
| `- error: branches have mismatching types 'Bool' and '[Int]'
4 | case 3: ""
5 | case 4: [1]
/Users/ovoorhees/Desktop/foo.swift:2:9: error: branches have mismatching types 'Int' and '[Int]'
1 | let x = switch 0 {
2 | case 1: 1
| `- error: branches have mismatching types 'Int' and '[Int]'
3 | case 2: false
4 | case 3: ""
Reproduction
let x = switch 0 {
case 1: 1
case 2: false
case 3: ""
case 4: [1]
}
Expected behavior
Ideally these would all be consolidated into one error covering all the branches, with notes pointing to each branch
Environment
6.2
Additional information
No response
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels