Open scabug opened 7 years ago
Imported From: https://issues.scala-lang.org/browse/SI-10250?orig=1 Reporter: Mohammed Azougarh (momoAG) Affected Versions: 2.12.1
I confirm that this is happening to me in 2.12.4
reproducible without the external dependency with:
Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_152).
Type in expressions for evaluation. Or try :help.
scala> import scala.language.implicitConversions
import scala.language.implicitConversions
scala> class Foo; implicit def string2foo(s: String): Foo = new Foo
defined class Foo
string2foo: (s: String)Foo
scala> (Option("a").getOrElse("b"): String): Foo
res0: Foo = Foo@646427f7
scala> Option("a").getOrElse("b"): Foo
<console>:15: error: type mismatch;
found : Object
required: Foo
Option("a").getOrElse("b"): Foo
^
whereas in Dotty:
scala> Option("a").getOrElse("b"): Foo
val res0: Foo = Foo@7ea08277