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

Handle enum literals that are not a defined value of the enum #30852

Merged
merged 2 commits into from
May 10, 2023

Conversation

ajcvickers
Copy link
Member

Fixes #30832

@ajcvickers ajcvickers requested a review from a team May 9, 2023 08:07
? GetCompositeEnumValue(type, value, fullName)
? type.IsDefined(typeof(FlagsAttribute), false)
? GetCompositeEnumValue(type, value, fullName)
: $"({type.DisplayName(fullName: true, compilable: true)}){UnknownLiteral(Convert.ChangeType(value, Enum.GetUnderlyingType(type)))}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
: $"({type.DisplayName(fullName: true, compilable: true)}){UnknownLiteral(Convert.ChangeType(value, Enum.GetUnderlyingType(type)))}"
: $"({Reference(type)}){UnknownLiteral(Convert.ChangeType(value, Enum.GetUnderlyingType(type)))}"

Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

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

Tests?

@ajcvickers
Copy link
Member Author

Tests?

CSharpRuntimeModelCodeGeneratorTest.cs have been updated? You'll need to expand the diff.

@AndriySvyryd
Copy link
Member

You'll need to expand the diff.

I shouldn't do reviews this early

@ajcvickers ajcvickers merged commit 47ba584 into main May 10, 2023
7 checks passed
@ajcvickers ajcvickers deleted the LeftBackUpDownSpace0508 branch May 10, 2023 14:49
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.

Sentinel not generated for enums on Optimize-DbContext
2 participants