Add enum variants to the type namespace

Change to resolve and update compiler and libs for uses.

WIP - TODO - tests; refactor

[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, but otherwise does it look OK? I expect some of the new names could be better).