Recursive types

I’ve been looking into what it would take to get rid of type mutability, and one annoying case I ran into is that the IR parser allows type forward references, so something like this is valid:

%a = type { %b }
%b = type { i8 }
@g = external global %a

However, we not just allow it, it’s also how the IR gets printed (all types grouped at the top, but with definitions after uses). So we can’t remove support for this without removing the ability to parse a lot of old IR.

It would be possible to work around this (by having our own type representation in LLParser for incomplete types), but it’s going to be rather ugly.