Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Sep 22, 2023
1 parent a7d1e33 commit 57a0f17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/_spec/05-classes-and-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,8 @@ enum Option[+T]:
An enum class is represented as a `sealed abstract` class that extends the `scala.reflect.Enum` trait.

Enum cases are represented as follows:
- a class enum case is mapped to a `case class` member of enum class' companion object,
- a singleton enum case is mapped to a `val` member of the enum class' companion object, implemented by a local class definition which may be shared between cases.
- a class enum case is mapped to a `case class` member of the enum class' companion object,
- a singleton enum case is mapped to a `val` member of the enum class' companion object, implemented by a local class definition. Whether that local class is shared with other singleton cases, and which ones, is left as an implementation detail.

###### Precise rules
The `scala.reflect.Enum` trait defines a single public method, `ordinal`:
Expand All @@ -994,7 +994,7 @@ Explicit `extends` clauses must be provided in the following cases, where rules

1. An `enum` definition
```scala
enum ´E´ <type-params> <value-params> { <defs> <cases> }
enum ´E´ <type-params> <value-params> extends <parents> { <defs> <cases> }
```
expands to a `sealed abstract` class that extends the `scala.reflect.Enum` trait and an associated companion object that contains the defined cases, expanded according to rules (2 - 8).
The enum class starts with a compiler-generated import that imports the names `<caseIds>` of all cases so that they can be used without prefix in the class.
Expand Down

0 comments on commit 57a0f17

Please sign in to comment.