Merge pull request #3662 from trentxintong/unicodescalar

SE-0128 - Change unicodescalar initializer to failable
This commit is contained in:
Xin Tong
2016-07-26 16:44:14 -07:00
committed by GitHub
18 changed files with 133 additions and 94 deletions

View File

@@ -60,7 +60,7 @@ func nthUnicodeScalar(_ n: UInt32) -> UnicodeScalar {
for r in unicodeScalarRanges {
count += r.upperBound - r.lowerBound
if count > n {
return UnicodeScalar(r.upperBound - (count - n))
return UnicodeScalar(r.upperBound - (count - n))!
}
}
_preconditionFailure("Index out of range")