object TablesReading {
def read(region: String)(date: Option[String] = None): String = {
region
}
def read(date: Option[String] = None): String = {
"all"
}
}
This throws the following error (scala version 2.13):
in object TablesReading, multiple overloaded alternatives of method read define default arguments.
I read Why does the Scala compiler disallow overloaded methods with default arguments? and https://docs.scala-lang.org/sips/named-and-default-arguments.html and learned that two overloads that have default values on the same parameter position would collide. But in this example, the parameter positions that have default values are different in the two overloads - wouldn't they generate two distinct functions like read$default$2
and read$default$1
? What am I missing?