Closed noresttherein closed 10 months ago
The spec mandates that the value class have a companion.
You always minimally get extensions for hashCode and equals.
The terms can be disambiguated using old-timey techniques.
It's a bug that dotty doesn't notice the error, or perhaps it's fooled by its encoding of object as lazy.
trait A {
def Damn: String = "flames"
//def Damn(implicit i: DummyImplicit): String = "flames"
}
object B extends A {
class Damn(val self: String) extends AnyVal
}
object Test {
def main(args: Array[String]): Unit = println {
//new B.Damn("perdition").hashCode
B.Damn
}
}
Reproduction steps
Scala version: (2.13.11
Problem
Omitting
extends AnyVal
, or, interestingly enough, adding a type parameter to methoddef Damn[X] :String
fixes the issue.