[Updated: This was an overly terse summary, which caused some confusion. I've elaborated (hopefully more clearly) here]
The current rules for switches require that constants in switches come from classes that do not override equality. The new pattern proposal adds a relational pattern == constant which is defined to call the equality operator on the receiver (and also relational operators similarly).
- Is
== constant intended to work when the receiver overrides operator ==?
- Does the proposal eliminate the current error for existing switches?
cc @lrhn @eernstg @munificent @stereotype441 @natebosch @jakemac53