Provide CanEqual for Option (Option == None), Throwables, and other
See original GitHub issueMinimized code
x match {
case Some(value) =>
case None =>
}
Output
[error] 129 | case None =>
[error] | ^^^^
[error] | Values of types object None and Option[T] cannot be compared with == or !=.
[error] | I found:
[error] |
[error] | CanEqual.canEqualOptions[T, U](/* missing */summon[CanEqual[T, U]])
[error] |
[error] | But no implicit values were found that match type CanEqual[T, U].
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.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
In Scala 3, is there a way to disable -language:strictEquality ...
Try limiting the scope of givens like so val x: Option[Throwable] = None { given CanEqual[Option[Throwable], Option[Throwable]] ...
Read more >OptionSugar - scalactic_2.13 3.2.4 javadoc - javadoc.io
Trait providing an implicit class that adds a toOr method to Option , which converts Some to Good , None to Bad ....
Read more >Scala Standard Library 2.13.3 - scala.Option
Represents optional values. Instances of Option are either an instance of scala.Some or the object None . The most idiomatic way to use...
Read more >play.api.Configuration
def reportError (path: String, message: String, e: Option[Throwable] = None): PlayException. Creates a configuration error for a specific configuration key.
Read more >Scaladoc for org.scalatest.events.InfoProvided
In this respect InfoProvided is different from the other events, ... the nameInfo of the InfoProvided event (an Option[NameInfo] ) should be None...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is that the
CanEqual
instance would logically have to be in the companion object ofOption
. But we cannot touch the standard library for the time being, since we want to use 2.13.At some point we need to decide that we will ship a Scala 3 specific standard library, and in that case
CanEqual
instances would be provided. Until then, I agree that-language:strictEquality
is not useful and should be avoided.@strelec Do you still have this problem? Are you using Scala 3.0.x? It should be fixed by #12419 and #13265 in Scala 3.1.0 and higher.