Files
swift-mirror/stdlib/public/Darwin/Foundation
Karoy Lorentey 1a9f7afdec [Foundation] Fix Data.count’s setter
Data provides a settable `count` property. Its expected behavior is undocumented, but based on the implementation, it is intended to zero-extend (or truncate) the collection to the specified length.

This does not work correctly if we start with an empty Data and we try to increase the count by a small integer:

```
import Foundation

var d = Data()
d.count = 2
print(d.count) // ⟹ 0 ⁉️

d.count = 100
print(d.count) // ⟹ 100 ✓
```

It looks like this bug was introduced with the Data overhaul that shipped in Swift 5.

(This issue was uncovered by https://github.com/apple/swift/pull/28918.)

rdar://58134026
2019-12-20 23:35:05 -08:00
..
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00
2019-04-18 15:39:40 -04:00