From 1c88c152eee5d5cd4c7363148f5c2b0c8d5b0fd1 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Fri, 22 Sep 2023 11:56:50 +0200 Subject: [PATCH] address review comments [Cherry-picked 57a0f174762e6009e46c77ba309d33b5301d499d] --- docs/_spec/05-classes-and-objects.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_spec/05-classes-and-objects.md b/docs/_spec/05-classes-and-objects.md index cc8d97704a50..e1d4ace3d81f 100644 --- a/docs/_spec/05-classes-and-objects.md +++ b/docs/_spec/05-classes-and-objects.md @@ -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`: @@ -994,7 +994,7 @@ Explicit `extends` clauses must be provided in the following cases, where rules 1. An `enum` definition ```scala - enum ´E´ { } + enum ´E´ extends { } ``` 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 `` of all cases so that they can be used without prefix in the class.