ワークシートで次を実行すると、すべてが期待どおりになります。
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())
新しいものをやめると、次のようなコンパイラ診断が表示されます。
- not enough arguments for method apply: (x: Int, xs: Set[Int])worksheet.P in object P. Unspecified value parameter xs.
同じ診断が通常の .scala ファイルに表示されます。
これはコンパイラのバグですか、それとも何か誤解していますか?