So as it turns out, the Swift compiler’s MergeModules phase (which SwiftPM uses in Debug builds) has a known issue with dependency cycles between separate source files — it rarely triggers, but when it does, swiftc hits an assertion complaining about a deserialization failure.
The v0.0.1 of Swift Collections happens to include such a cycle, but it only triggers the assertion on a small fraction of machines. I don’t yet know what exactly makes it nondeterministic, but it is reproducible by randomly reshuffling the source filenames of the OrderedSet implementation — a couple dozen randomizations will eventually lead to a state where it happens in every build.
The workaround is to put OrderedSet’s Sequence and RandomAccessCollection conformances in the same file. (OrderedSet uses the standard IndexingIterator, which requires a Collection conformance, while Collection itself refines Sequence — I believe this is the dependency cycle that is causing all this problem.)
Unfortunately, until we figure out what triggers the nondeterminism (or until the MergeModules action is replaced with something that actually, you know, works, this issue may keep randomly reoccurring. None of this makes much sense, but here we are. 😝
This type was one of the prototypes for `OrderedSet` — it allowed us to customize the collection type used for element storage. (E.g., using `Deque` instead of `Array` to get efficient insertions at the front.) The original idea was that `OrderedSet` would simply be a typealias:
```swift
typealias OrderedSet<Element> = Uniqued<Array<Element>>
```
Unfortunately, while this concept is intellectually pleasing, in practice it just made the interface more complicated (and, in some cases, slower). Worse, it cannot be directly translated to an `OrderedDictionary`-style key-value mapping without major usability problems.
# Conflicts:
# Package.swift