Commit Graph
11 Commits
Author SHA1 Message Date
Karoy Lorentey 6286cd0b99 Restore support for building with Swift 5.5
This is mostly about adding more type declarations to deal with type checker limitations in the older compiler.
This also includes workarounds that allow better support for CodingKeyRepresentable in PersistentDictionary, and it fixes a couple of small oversights on various #else branches.
2022-10-10 18:07:49 -07:00
Karoy Lorentey 6dfad714a1 [PersistentCollections] _Node.update → _Node.updateValue
To prevent confusion with the low-level _Node.update method.

This also switches PersistentSet.insert to use `_Node.insert` instead of `_Node.updateValue`, to fix its semantics. `insert` no longer invalidates indices when the new member already exists in the collection.
2022-09-30 12:19:40 -07:00
Karoy Lorentey 03c1bd958a [PersistentSet] Implement structural union operation (untested) 2022-09-27 14:18:39 -07:00
Karoy Lorentey 826e22c91e [PersistentDictionary] Implement structural filter & compactMapValues
Plus add tests covering these as well and mapValues.
2022-09-24 17:09:36 -07:00
Karoy Lorentey 9150bbf06e [PersistentCollections] Cache the item hash within collision nodes
This will simplify merge operations as we no longer have to spend effort on preventing repeated rehashings of items within collision nodes.

Also, review and simplify node allocation and lookup code.
2022-09-23 11:15:56 -07:00
Karoy Lorentey eefef1e585 [PersistentCollections] Small path-related adjustments 2022-09-23 11:15:46 -07:00
Karoy Lorentey 958fd47539 [PersistentSet] Start drafting the new type 2022-09-21 10:45:20 -07:00
Karoy Lorentey ea30715a6c [PersistentDictionary] Implement Keys and Values views 2022-09-19 21:25:07 -07:00
Karoy Lorentey a2491aac45 [PersistentDictionary] Improved copy & resize operations
Don’t copy the current node and then insert a new item into it.
Instead, create the copy with the new item already inserted.

Ditto for new collisions.
2022-09-19 21:25:07 -07:00
Karoy Lorentey f7c419d7cf [PersistentDictionary] Rework allocations 2022-09-19 21:25:07 -07:00
Karoy Lorentey 53895c6537 [PersistentCollections] Split up node mutations into multiple files 2022-09-19 21:24:37 -07:00