Closed
Description
The following code compiles in Scalac 2.12. However, if we give explicit type to x
, it compiles neither in Scalac nor Dotty.
class Test {
implicit val m: Int = 10
def get(implicit x: Int): Int = ???
def bar: Unit = {
implicit val x = get
// implicit val x: Int = get
}
}
Error message:
5 | implicit val x: Int = get
| ^
| x is a forward reference extending over the definition of x
Such code exists in ScalaTest:
implicit val strEq = StringNormalizations.lowerCased.toEquality
es.contains("one") shouldBe true;
es.contains("ONE") shouldBe false
trait NormalizingEquality[A] extends Equality[A]
trait Uniformity[A] extends Normalization[A] {
final def toEquality(implicit equality: Equality[A]): NormalizingEquality[A] = ...
}