stdlib: fix mirrors for UTF8 and UTF16 String views so that they actually work

instead of causing a stack overflow

rdar://17897212


Swift SVN r20974
This commit is contained in:
Dmitri Hrybenko
2014-08-03 19:44:17 +00:00
parent 6e6e20ab4b
commit 4c0075f5bd
2 changed files with 53 additions and 2 deletions

View File

@@ -26,9 +26,9 @@ extension String {
var count: Int { return distance(_value.startIndex,_value.endIndex) }
subscript(i: Int) -> (String,MirrorType) {
subscript(i: Int) -> (String, MirrorType) {
_precondition(i >= 0 && i < count, "MirrorType access out of bounds")
return ("[\(i)]", reflect(self[i]))
return ("[\(i)]", reflect(_value[advance(_value.startIndex, i)]))
}
var summary: String { return String(_value._core) }