Skip to content

Commit adc4dd3

Browse files
committed
Fix #6601: Require that enum cases extend the enum
1 parent c5a3b5c commit adc4dd3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/docs/internals/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ yield
105105

106106
```
107107
as derives extension inline on opaque open using
108-
~ * | & + -
108+
* + -
109109
```
110110

111111
## Context-free Syntax

docs/docs/reference/enums/desugarEnums.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ Cases such as `case C` expand to a `@static val` as opposed to a `val`. This all
196196

197197
### Other Rules
198198

199-
A normal case class which is not produced from an enum case is not allowed to extend
199+
- A normal case class which is not produced from an enum case is not allowed to extend
200200
`scala.Enum`. This ensures that the only cases of an enum are the ones that are
201201
explicitly declared in it.
202+
203+
- If an enum case has an extends clause, the enum class must be one of the
204+
classes that's extended.

0 commit comments

Comments
 (0)