mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Make String.UTF8View bidirectional
This is a step along the way toward handling backward-compatiblity of UTF8View slicing and preventing inadvertent creation of String instances that keep inaccessible memory alive.
This commit is contained in:
@@ -7,7 +7,7 @@ func acceptsRandomAccessCollection<I: RandomAccessCollection>(_: I) {}
|
||||
|
||||
func testStringCollectionTypes(s: String) {
|
||||
acceptsCollection(s.utf8)
|
||||
acceptsBidirectionalCollection(s.utf8) // expected-error{{argument type 'String.UTF8View' does not conform to expected type 'BidirectionalCollection'}}
|
||||
acceptsBidirectionalCollection(s.utf8)
|
||||
acceptsRandomAccessCollection(s.utf8) // expected-error{{argument type 'String.UTF8View' does not conform to expected type 'RandomAccessCollection'}}
|
||||
|
||||
// UTF16View is random-access with Foundation, bidirectional without
|
||||
|
||||
Reference in New Issue
Block a user