If we serialize a dictionary where an association is used as a key, STON stores it ambiguously and then reconstructs it wrongly.
Example / test:
| originalDictionary text rebuiltDictionary |
originalDictionary := { (1 -> 'a') -> 1234 } asDictionary.
text := (STON toString: originalDictionary).
rebuiltDictionary := STON fromString: text.
self assert: rebuiltDictionary = originalDictionary
In the example, the dictionary is serialized into {1:'a':1234}. While originally 1->'a' is a key and 1234 is a value, the rebuiltDictionary has 1 as a key and 'a'->1234 as value.
The issue is present in all recent versions of Pharo (tested 6-14).
If we serialize a dictionary where an association is used as a key, STON stores it ambiguously and then reconstructs it wrongly.
Example / test:
In the example, the dictionary is serialized into
{1:'a':1234}. While originally1->'a'is a key and1234is a value, the rebuiltDictionary has1as a key and'a'->1234as value.The issue is present in all recent versions of Pharo (tested 6-14).