In Xcode 8.3.2 and the latest development snapshot (April 24, 2017), the following code:
crashes at runtime on the `let a = Tree` line with the error:
> GenericCache(0x100658d08): cyclic metadata dependency detected, aborting
By my understanding, this should be valid code, despite the recursive definition, since the layout of `Array` does not depend on its generic parameter.
Indeed, change the definition of `parentAndChildren` to:
and there's no problem – the code works as expected.
In addition to changing the contents of the `case`, it is possible to declare the original `parentAndChildren` case as `indirect` and the problem goes away.
Ideally, the original code should work. If that isn't possible, a compile time error (forcing the use of `indirect`) would be preferable to a runtime crash.
Previous bugs returning the same error include:
However, it's not clear if either of these are precisely the same problem.