Skip to content

Dictionary with associations as keys is not reconstructed properly #45

Description

@JanBliznicenko

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions