mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -71,7 +71,7 @@ func acceptsRandomAccessCollection<C: RandomAccessCollection>(_: C) {}
|
||||
|
||||
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'}}
|
||||
|
||||
acceptsCollection(s.utf16)
|
||||
|
||||
Reference in New Issue
Block a user