When playing with scala's dependent method types, I encountered a conflict with default method parameters:
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
}
The message is:
[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
If I remove the argument with default value from method definition and implementation, the example compiles successfully. What am I doing wrong? Is it a bug?
P.S. I am using Scala 2.11.4