-
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
The diagnostic is confusing when matching UInt with negative integer literal
Reproduction
func test(val: UInt) {
switch val { // error: integer literal '-24' overflows when stored into unsigned 'Builtin.Int64'
case 12: break
case -24: break
default: break
}
}
Expected behavior
Message should be at least integer literal '-24' overflows when stored into unsigned 'UInt'
, but preferably more like integer literal '-24' is invalid for unsigned type 'UInt'
.
The diagnostic location is also off, it should be on the -24
literal.
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