From 13277c3889a60376726292dcf897a93c37dcc964 Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Thu, 26 Sep 2024 21:59:31 +0200 Subject: [PATCH] Make adjustments following issue #4015 (#4103) Introduce compile-time errors about augmentation of "built-in" properties of an `enum` declaration, following issue #4015. --- .../augmentation-libraries/feature-specification.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/working/augmentation-libraries/feature-specification.md b/working/augmentation-libraries/feature-specification.md index 5c78cd6a9..2b4ac8f5c 100644 --- a/working/augmentation-libraries/feature-specification.md +++ b/working/augmentation-libraries/feature-specification.md @@ -726,7 +726,15 @@ It is a **compile-time error** if: * An `external` variable is augmented with an `abstract` variable. -### Augmenting enum values +### Augmenting enum members + +Some enum members can not be augmented: It is a compile-time error if an +augmenting declaration in an enum declaration (introductory or augmenting) +has the name `values`, `index`, `hashCode`, or `==`. + +*It has always been an error for an enum declaration to declare a member +named `index`, `hashCode`, `==`, or `values`, and this rule just clarifies +that this error is applicable for augmenting declarations as well.* Enum values can _only_ be augmented by enum values, and the implicit getter introduced by them is not augmentable. The only thing you are allowed to do