-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide CanEqual for Option (Option == None), Throwables, and other #15521
Comments
The problem is that the At some point we need to decide that we will ship a Scala 3 specific standard library, and in that case |
We may be able to synthesize that instance while we still use the 2.13 library |
Synthesizing looks very hard when we need to put the Maybe we should deprecate |
I agree with @odersky here about deprecating Being a scala user for almost 10 years now, it is the first feature I did not really like. So much boilerplate just to get a bit better type safety. And it feels I was fighting it the whole way. I also do not like it generates a method with a bunch of lazy val fields the JVM bytecode (I thought it was erased at compile time). I think that the solution that outputs a compiler warning (or heck, even an error) when two things cannot possibly be equal would be a step gap solution that could serve us for years. Eventually we will find a proper solution that will still be playing nicely with the JVM. But that will require some serious out out the box idea, so let's not commit to a solution in question just yet. |
I'm unable to reproduce this with //> using scala 3.nightly
//> using options -Wunused:all -language:strictEquality
object Test:
val x: Option[String] = None
x match {
case Some(value) =>
case None =>
} Can this be closed, or am I missing something from your original case @strelec |
Minimized code
Output
Expectation
CanEqual
instance should come already defined for at the very least, the standard library. You have to strike a balance between versatility and usability.As it is currently,
-language:strictEquality
is too cautious to be useful.The text was updated successfully, but these errors were encountered: