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

fix code generation for enum with generics #2581

Merged
merged 2 commits into from
Aug 27, 2023
Merged

fix code generation for enum with generics #2581

merged 2 commits into from
Aug 27, 2023

Conversation

nikitadol
Copy link
Contributor

Sometimes you need to use enum with generics:

enum MyEnum<T> {
  ...
}

But in this case, the code generator generates the wrong code:

  static JsonTypeConverter2<MyEnum<Object?>, int, int> $convertername =
      const EnumIndexConverter<MyEnum<Object?>>(MyEnum<Object?>.values);

Since this part is not considered valid in Dart:

MyEnum<Object?>.values

Correct use:

MyEnum.values

This PR fixes this behavior

Copy link
Owner

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

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

Good catch and thanks for the fix, LGTM!

@simolus3 simolus3 merged commit 18b11d7 into simolus3:develop Aug 27, 2023
10 checks passed
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.

2 participants