Implement compile-time checks for illegal states