12
Podczas odtwarzania z zależnych od rodzaju metody Scala, natknąłem się na konflikt z parametrów metody domyślnie:Dependent rodzaje metoda konflikt z domyślnymi argumentami
abstract class X {
type Y
case class YY(y: Y)
}
object XX extends X {
type Y = String
}
trait SomeTrait {
def method(x: X)(y: x.YY, default: Int = 3): Unit
}
object SomeObject extends SomeTrait {
def method(x: X)(y: x.YY, default: Int): Unit = {}
method(XX)(XX.YY("abc")) // fails to compile
}
wiadomość jest:
[error] found : me.alexbool.XX.YY
[error] required: x$1.YY
[error] Error occurred in an application involving default arguments.
[error] method(XX)(XX.YY("abc")) // fails to compile
Jeśli usunąć argument z wartością domyślną z definicji i implementacji metody, przykład kompiluje się pomyślnie. Co ja robię źle? Czy to błąd?
P.S. Używam Scala 2.11.4
Wygląda jak błąd. –