-
Notifications
You must be signed in to change notification settings - Fork 161
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
Attribute decoration to generate cast from one OneOfBase to another #132
Comments
This is particularly useful when when using option types, for example
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Considder the following code:
To remedy the error, one can add to
RealOutcome
the following boilerplate method:I've done this more than a few times now (love this library!), so it would be really nice to have a shorthand that just generates the cast. Something like
[GenerateOneOfImplicitCastAttribute<PartialOutcome>]
(Now that we have generic attributes!)This should of course only work if the type cast from's generic types are all contained in the cast to's generic types
I'd write it myself, but source generators still bend my mind for the time being.
The text was updated successfully, but these errors were encountered: