My original implementation of Dart followed one of the other language's enum implementations in that it appended Item to the name of each variant. After using it for a while it turns out it's rather annoying and seems to be wholly unnecessary as the enum name is prepended to each variant when generating class based enums and this seems to avoid any chance of collision. Considering that Dart is still considered "under development" I figured it was a good time to walk this back.
For Rust enum:
enum Choice {
A,
B,
C
}
Current output:
abstract class Choice {}
class ChoiceAItem extends Choice {}
class ChoiceBItem extends Choice {}
class ChoiceCItem extends Choice {}
This PR's output:
abstract class Choice {}
class ChoiceA extends Choice {}
class ChoiceB extends Choice {}
class ChoiceC extends Choice {}
Summary
My original implementation of Dart followed one of the other language's enum implementations in that it appended
Item
to the name of each variant. After using it for a while it turns out it's rather annoying and seems to be wholly unnecessary as the enum name is prepended to each variant when generating class based enums and this seems to avoid any chance of collision. Considering that Dart is still considered "under development" I figured it was a good time to walk this back.For Rust enum:
Current output:
This PR's output:
Test Plan
Uses existing test.