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

[Dart, master] Enum named "value" causes variable name conflict #8052

Open
macca717 opened this issue Jul 31, 2023 · 4 comments · May be fixed by #8285
Open

[Dart, master] Enum named "value" causes variable name conflict #8052

macca717 opened this issue Jul 31, 2023 · 4 comments · May be fixed by #8285

Comments

@macca717
Copy link

Declaring an enum name as "value" as in the example below results in a redefined name conflict in the generated dart code.

enum ExampleEnum : uint8
{
    none = 0,
    value = 1,
}

By running flatc --dart --gen-all --gen-object-api minimal.fbs generates the attached invalid dart code in the ExampleEnum class;

minimal_test_enum_generated.dart.txt

Copy link

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 30, 2024
@insertjokehere
Copy link
Contributor

This is still an issue

@github-actions github-actions bot removed the stale label Jan 31, 2024
insertjokehere added a commit to insertjokehere/flatbuffers that referenced this issue Apr 19, 2024
…mes not reserved by the Flatbuffers IDL

Fixes google#8052

The Flatbuffers IDL allows for enums to have values called "value", "values", "minValue" or "maxValue", but if these names are used for values in an enum, the generated Dart code won't compile.

This modifies the Dart generator to use "$value", "$values", "$minValue" and "$maxValue" instead, so that valid Flatbuffer schemas can be used wth Dart
insertjokehere added a commit to insertjokehere/flatbuffers that referenced this issue Apr 19, 2024
…mes not reserved by the Flatbuffers IDL

Fixes google#8052

The Flatbuffers IDL allows for enums to have values called "value", "values", "minValue" or "maxValue", but if these names are used for values in an enum, the generated Dart code won't compile.

This modifies the Dart generator to use "$value", "$values", "$minValue" and "$maxValue" instead, so that valid Flatbuffer schemas can be used wth Dart
insertjokehere added a commit to insertjokehere/flatbuffers that referenced this issue Apr 19, 2024
…mes not reserved by the Flatbuffers IDL

Fixes google#8052

The Flatbuffers IDL allows for enums to have values called "value", "values", "minValue" or "maxValue", but if these names are used for values in an enum, the generated Dart code won't compile.

This modifies the Dart generator to use "$value", "$values", "$minValue" and "$maxValue" instead, so that valid Flatbuffer schemas can be used wth Dart
Copy link

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jul 31, 2024
@macca717
Copy link
Author

Bump

@github-actions github-actions bot removed the stale label Aug 1, 2024
insertjokehere added a commit to insertjokehere/flatbuffers that referenced this issue Aug 16, 2024
…rated classes

Fixes google#8052

The Dart code generated for enums includes class properties called 'value', 'values', 'minValue' and 'maxValue'. If the Flatbuffer schema includes enums with these values, the generated code will be invalid. This modifies the Dart generator to rename enum properties if they will conflict with these names (as well as the existing rules to avoid conflicts with Dart keywords)
insertjokehere added a commit to insertjokehere/flatbuffers that referenced this issue Aug 16, 2024
…rated classes

Fixes google#8052

The Dart code generated for enums includes class properties called 'value', 'values', 'minValue' and 'maxValue'. If the Flatbuffer schema includes enums with these values, the generated code will be invalid. This modifies the Dart generator to rename enum properties if they will conflict with these names (as well as the existing rules to avoid conflicts with Dart keywords)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants