Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007258 [Squeak] Collections minor always 12-30-08 22:50 04-18-10 22:04
Reporter nicolas cellier View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version trunk Product Version 3.10
  Product Build
Summary 0007258: Dictionary asSet is wrong
Description Following http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-June/117894.html [^]
that recently came up through http://lists.gforge.inria.fr/pipermail/pharo-project/2008-December/004305.html [^]
I have prepared a little test:

| aDictionary aSet |
aDictionary := Dictionary new.
aSet := aDictionary asSet.
assoc0 := #first -> 0.
assoc1 := #first -> 1.
aSet add: assoc0; add: assoc1.
self
    assert: (assoc0 ~= assoc1) ==> (aSet size > 1)
    description: '
        When adding two different elements,
        the set size should be greater than one'
Steps To Reproduce
Additional Information Guess what is (aSet class) ?

No, a Dictionary is not a Set of associations, at least since Assocation>>#= has been changed to also test the value.

It used to be a Set of Associations in st80 when only the association key was compared...
Attached Files  M7258-Dictionary-asSet-Test-nice.1.cs [^] (938 bytes) 10-06-09 12:24
 M7258-Dictionary-asSet-Patch-nice.1.cs [^] (1,635 bytes) 10-06-09 12:25

- Relationships

- Notes
(0012885 - 530 - 778 - 778 - 778 - 778 - 778)
nicolas cellier
12-30-08 22:57
edited on: 12-30-08 23:34

"Hem, I posted my test too fast...
 it results in assoc0 = assoc1, because #add: will modify assoc0 in place...
 though aSet size = 1, the assertion did not fail..."

| aDictionary aSet assoc0 assoc1 |
aDictionary := Dictionary new.
aSet := aDictionary asSet.
assoc0 := #first -> 0.
assoc1 := #first -> 1.
aSet add: assoc0 copy; add: assoc1.
self
    assert: (assoc0 copy ~= assoc1) ==> (aSet size > 1)
    description: '
        When adding two different elements,
        the set size should be greater than one'

 
(0013359 - 181 - 235 - 235 - 235 - 235 - 235)
nicolas cellier
10-06-09 12:26

"fix begin"
Installer mantis bug: 7258 fix:'M7258-Dictionary-asSet-Patch-nice.1.cs'.
"fix test"
Installer mantis bug: 7258 fix:'M7258-Dictionary-asSet-Test-nice.1.cs'.
"fix end"
 
(0013360 - 130 - 136 - 466 - 466 - 466 - 466)
nicolas cellier
10-06-09 12:31

Fixed in http://source.squeak.org/trunk/Collections-nice.162.mcz [^]
and http://source.squeak.org/trunk/CollectionsTests-nice.102.mcz [^]
 

- Issue History
Date Modified Username Field Change
12-30-08 22:50 nicolas cellier New Issue
12-30-08 22:57 nicolas cellier Note Added: 0012885
12-30-08 22:58 nicolas cellier Note Edited: 0012885
12-30-08 23:34 nicolas cellier Note Edited: 0012885
10-06-09 12:24 nicolas cellier File Added: M7258-Dictionary-asSet-Test-nice.1.cs
10-06-09 12:25 nicolas cellier File Added: M7258-Dictionary-asSet-Patch-nice.1.cs
10-06-09 12:26 nicolas cellier Note Added: 0013359
10-06-09 12:26 nicolas cellier Issue Monitored: nicolas cellier
10-06-09 12:31 nicolas cellier Status new => resolved
10-06-09 12:31 nicolas cellier Fixed in Version  => trunk
10-06-09 12:31 nicolas cellier Resolution open => fixed
10-06-09 12:31 nicolas cellier Assigned To  => nicolas cellier
10-06-09 12:31 nicolas cellier Note Added: 0013360
04-18-10 22:04 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
57 total queries executed.
35 unique queries executed.
Powered by Mantis Bugtracker