Fix ICE on statics with fancy nullable enums.

Closes #8506.