| // Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| /// @assertion An introductory `enum` declaration introduces implicit |
| /// introductory and complete declarations of: |
| /// - `int get index` |
| /// - `int get hashCode` |
| /// - `bool operator ==(Object)` |
| /// - `static const List<E> values;` where `E` is the enum type. |
| /// For ordering purposes, these implicit declarations are before any members |
| /// declared in the declaration. |
| /// |
| /// @description Checks that it is not an error if an augmentation adds a static |
| /// setter named `values`. |
| /// @author sgrekhov22@gmail.com |
| |
| // SharedOptions=--enable-experiment=augmentations |
| |
| import '../../Utils/expect.dart'; |
| |
| String log = ''; |
| |
| enum E { |
| e0; |
| } |
| |
| augment enum E { |
| ; |
| static void set values(List<E> _) { |
| log = 'Setter called'; |
| } |
| } |
| |
| main() { |
| E.values = []; |
| Expect.equals('Setter called', log); |
| } |