Skip to content

Commit 3a3e9f8

Browse files
committed
---
yaml --- r: 349536 b: refs/heads/master-next c: 1329d52 h: refs/heads/master
1 parent 162d17d commit 3a3e9f8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 0fd3e1dfb7f3f131d5d578f6b1e2322c7d4fd768
3+
refs/heads/master-next: 1329d52a2117d2358bbaac27201cbc0d3ace4c3b
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/validation-test/stdlib/String.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ StringTests.test("Index/Hashable") {
220220
expectTrue(t.contains(s.startIndex))
221221
}
222222

223+
var Swift_5_1_Available: Bool {
224+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
225+
return true
226+
}
227+
return false
228+
}
229+
223230
StringTests.test("ForeignIndexes/Valid") {
224231
// It is actually unclear what the correct behavior is. This test is just a
225232
// change detector.
@@ -238,6 +245,10 @@ StringTests.test("ForeignIndexes/Valid") {
238245
let acceptor = "\u{1f601}\u{1f602}\u{1f603}"
239246
expectEqual("\u{1f601}", acceptor[donor.startIndex])
240247

248+
// Scalar alignment fixes and checks were added in 5.1, so we don't get the
249+
// expected behavior on prior runtimes.
250+
guard Swift_5_1_Available else { return }
251+
241252
// Donor's second index is scalar-aligned in donor, but not acceptor. This
242253
// will trigger a stdlib assertion.
243254
let donorSecondIndex = donor.index(after: donor.startIndex)
@@ -257,6 +268,10 @@ StringTests.test("ForeignIndexes/UnexpectedCrash") {
257268
// Adjust donor.startIndex to ensure it caches a stride
258269
let start = donor.index(before: donor.index(after: donor.startIndex))
259270

271+
// Grapheme stride cache under noop scalar alignment was fixed in 5.1, so we
272+
// get a different answer prior.
273+
guard Swift_5_1_Available else { return }
274+
260275
// `start` has a cached stride greater than 1, so subscript will trigger an
261276
// assertion when it makes a multi-grapheme-cluster Character.
262277
if _isStdlibInternalChecksEnabled() {

0 commit comments

Comments
 (0)