Add enum variants to the type namespace

Change to resolve and update compiler and libs for uses.

[breaking-change]

Enum variants are now in both the value and type namespaces. This means that
if you have a variant with the same name as a type in scope in a module, you
will get a name clash and thus an error. The solution is to either rename the
type or the variant.

closes #17323

r? anyone? (I realise this still needs a cfail test (and the commit message, I just noticed), but otherwise does it look OK? I expect some of the new names could be better).