A certain combination of spaces and ordering along with back windows in parameter names, where the return name has the same leading characters as another parameter, is misleading to the compiler to create compilation errors:
Announcement
case class A(`abc def`: List[Int], abc: String)
leads to
[info] Compiling 7 Scala sources to ...
[error] (test:compileIncremental) scala.reflect.internal.Types$TypeError: type mismatch;
[error] found : List
[error] required: String
[error] Total time: 2 s, completed Feb 10, 2016 11:09:51 AM
This problem seems to depend on the order and type of parameters, as well as the type of declaration, because all of the following compile just fine:
case class A(abc: String, `abc def`: List[Int])
case class B(`abc def`: String, abc: String)
case class C(`bbc def`: List[Int], abc: String)
def x(`abc def`: List[Int], abc: String) = 42
Is this a mistake or somehow expected?
Scala 2.11.7
source
share