Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

19779978: Swift 1.2: runtime exception when closed range includes max value for type #10953

Open
openradar-mirror opened this issue Apr 14, 2016 · 0 comments

Comments

@openradar-mirror
Copy link

Description

Summary:
When using a closed range in a switch case, and then end of the range is the maximum value for the variable type (e.g.: 0xFF for UInt8, 0xFFFF for UIn16, etc...), the application will crash at runtime when reaching the switch

Steps to Reproduce:
Sample code

let a: UInt8 = 0 // Any number here, doesn't matter
switch a {
case 0xF0...0xFF: // Any start value, doesn't matter
println("a")
default:
break
}

Expected Results:
Switch is executed correctly

Actual Results:
Console output:

fatal error: Range end index has no valid successor

Exception stack:

Product Version: Xcode 6.3 beta1 (6D520o) / Swift 1.2
Created: 2015-02-10T12:07:15.930499
Originated: 2015-10-02T00:00:00
Open Radar Link: http://www.openradar.me/19779978

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant