Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check duplicate value on enum type #742

Merged
merged 2 commits into from
Dec 8, 2022
Merged

Check duplicate value on enum type #742

merged 2 commits into from
Dec 8, 2022

Conversation

josecleiton
Copy link
Collaborator

Dart doesn't allow duplicate value on enum type.

Also resolves #739

@josecleiton josecleiton changed the title fix(dart): prevent duplicate enum value Prevent duplicate enum value Dec 8, 2022
@josecleiton josecleiton changed the title Prevent duplicate enum value Prevent duplicate enum value on dart generator Dec 8, 2022
@josecleiton josecleiton changed the title Prevent duplicate enum value on dart generator Prevent duplicate enum value Dec 8, 2022
@josecleiton josecleiton changed the title Prevent duplicate enum value Check duplicate value on enum type Dec 8, 2022
super.visit(node);

if (node instanceof EnumType) {
if (node.values.length !== new Set(node.values).size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (node.values.length !== new Set(node.values).size) {
if (node.values.length !== new Set(node.values.map(x => x.value)).size) {

@lbguilherme lbguilherme merged commit 8ec278f into sdkgen:master Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dart] Replace hashList to Object.hashAllUnordered
2 participants