E004: Case Class Missing Param List
This error is emitted when a case class is defined without any parameter list. In Scala 3, case classes must have at least one parameter list.
Empty must have at least one parameter list. If you would rather have a singleton representation of Empty, use a case object. Or, add an explicit () as a parameter list to Empty.
Example
case class Empty
Error
-- [E004] Syntax Error: example.scala:1:11 -------------------------------------
1 |case class Empty
| ^^^^^
| A case class must have at least one parameter list
|-----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Empty must have at least one parameter list, if you would rather
| have a singleton representation of Empty, use a "case object".
| Or, add an explicit () as a parameter list to Empty.
-----------------------------------------------------------------------------
Solution
// Use case object for singleton representation
case object Empty
// Add an explicit empty parameter list
case class Empty()
// Or define actual parameters
case class Empty(value: String)
In this article