Skip to content

Syntax error when putting def in enum object after simple case #3460

Closed
@smarter

Description

@smarter

This doesn't compile:

enum class Ducks

object Ducks {
  case Dewey

  def wooohoo: Int = 1
}
-- [E039] Syntax Error: enumo.scala:6:6 ------------------------------------
6 |  def woohoo: Int = 1
  |      ^^^^^^
  |      ';' expected, but identifier found

This can be worked around by writing case Dewey; or case Dewey extends Ducks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions