much simpler (re)implementation of EnumAsIdentifier check