[BUG][FIX] WeakKeyDictionary>>keysAndValuesDo: ([er][et]
could probably go in 3.8alpha?)
Andrew P. Black
black at cse.ogi.edu
Thu Jul 15 16:25:19 UTC 2004
>On Tuesday, July 13, 2004, at 03:35 PM, Chris Muller wrote:
>
>>There was a lot of intense discussion following my original post
>>(http://lists.squeakfoundation.org/pipermail/squeak-dev/2004-June/078915.html)
>>that included the fix and SUnit test. Since 3.7gamma is approaching fast, I
>>thought it would be appropriate to try to rejuvenate a review of this simple
>>bug fix.
I was concerned that this fix might conflict with the major
refactoring of Associations (including KeyKeyAssociations, to remove
a level of indirection) that I submitted earlier this week.
I ran the following (slightly modified, as suggested by Doug) test in
a 3.7beta image both with and without my Association refactoring.
testNoNils
| d foundNil |
foundNil _ false.
d _ WeakIdentityKeyDictionary new
at: 'hello' copy put: 'world';
yourself.
Smalltalk garbageCollectMost.
d keysAndValuesDo: [ : k : v | k ifNil: [ foundNil ] ].
self deny: foundNil
The test PASSED in BOTH cases. This is because the critical line should read:
d keysAndValuesDo: [ : k : v | k ifNil: [ foundNil _ true ] ].
OOPS!
With this fix,the test indeed fails before the patch is installed,
and passes afterwards.
Andrew
More information about the Squeak-dev
mailing list
|