When I run the following in a worksheet, everything is as expected.
case class P(x: Int, xs: Set[Int]) {
def this(x: Int) = this(x, Set[Int]())
}
P(1, Set()) //> res0: worksheet.P = P(1,Set())
new P(1) //> res0: worksheet.P = P(1,Set())
When I leave off the new I get a compiler diagnostic that says:
- not enough arguments for method apply: (x: Int, xs: Set[Int])worksheet.P in object P. Unspecified value parameter xs.
The same diagnostic appears in a regular .scala file.
Is this a compiler bug, or am I misunderstanding something?