semantic: Do switch validity checking in semantic.