A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-pre.1027.mcz
==================== Summary ====================
Name: Collections-pre.1027 Author: pre Time: 2 January 2023, 1:32:23.607278 pm UUID: 3c8f701b-fa5a-a142-9b00-0520960f1420 Ancestors: Collections-ct.1026
Fixes an issue with LimitedWriteStream>>#nextPutAll: which results in the stream ignoring its write limit.
This removes the duplicate logic for adding the incoming elements to the stream collection. The new version only puts as many elements as would fit into the collection or, if all of the incoming collection fits, uses the super method.
Complements CollectionTests pre.384.
=============== Diff against Collections-ct.1026 ===============
Item was changed: ----- Method: LimitedWriteStream>>nextPutAll: (in category 'writing') ----- nextPutAll: aCollection
| newEnd | - collection class == aCollection class ifFalse: - [^ super nextPutAll: aCollection ]. - newEnd := position + aCollection size. + newEnd > limit + ifTrue: [ + super nextPutAll: (aCollection copyFrom: 1 to: (limit - position max: 0)). + limitBlock value. + ^aCollection] + ifFalse: [^ super nextPutAll: aCollection]! - newEnd > limit ifTrue: [ - super nextPutAll: (aCollection copyFrom: 1 to: (limit - position max: 0)). - limitBlock value. - ^aCollection - ]. - newEnd > writeLimit ifTrue: [ - self growTo: newEnd - ]. - - collection replaceFrom: position+1 to: newEnd with: aCollection startingAt: 1. - position := newEnd. - ^aCollection!
squeak-dev@lists.squeakfoundation.org