Lots of nightly fixes 

Lots of uninteresting changes. Thanks to @0xc0170 for the starting point and prodding me to finally undertake fixing this mess.

Now since `enum`s are qualified it would likely make sense to shorten some of the variant names. I didn't undertake this in an effort to keep the impact of this fix small but others should feel free to do so.

@farcaller there is still a pair of failing cases in the platformtree testsuite. Could you have a look at these?