Upgrade the old mangling from a list of argument types to a
list of requiremnets. For now, only same-type requirements
may actually be mangled since those are all that are available
to the surface language.
Reconstruction of existential types now consists of demangling (a list of)
base protocol(s), decoding the constraints, and converting the same-type
constraints back into a list of arguments.
rdar://96088707
Creating a mangle-node tree is annoying, but it's much better
than trying to reproduce the mangling logic exactly.
Also, add support for mangling some existential types. The
specifier for parameterized protocol types has been future-proofed
against the coming change to include the associated type names
in the mangling.
Some parts of the type metadata system are difficult to unit-test
because they rely on structures that contain relative references,
which the C compiler cannot generate. We have traditionally just
relied on integration testing with the compiler. For constrained
existentials, I wanted to do better, so I spent a few days hacking
up this little system which can generate graphs of objects with
relative references to one another.
Currently it's missing the ability to generate a lot of things
which I didn't need in order to adequately test the metadata
system for constrained existentials.