Support @serdeEnumProxy (@serdeProxyCast) UDA#22
Merged
9il merged 2 commits intolibmir:masterfrom Oct 2, 2022
Merged
Conversation
fa8175f to
173d595
Compare
Contributor
Author
|
marking as draft to explore different PR right now |
WebFreak001
added a commit
to WebFreak001/mir-ion
that referenced
this pull request
Jun 24, 2022
support e.g. deserializing int to Variant!(void, ProxiedInt) Side-effect: this allows us to easily implement serdeProxyCast, which is done here and supersedes the PR libmir#22
WebFreak001
added a commit
to WebFreak001/mir-ion
that referenced
this pull request
Jun 24, 2022
support e.g. deserializing int to Variant!(void, ProxiedInt) Side-effect: this allows us to easily implement serdeProxyCast, which is done here and supersedes the PR libmir#22
173d595 to
8e3ffe5
Compare
Contributor
Author
|
not sure if integration test failures are related, the code changes here are entirely compile-time opt-in by annotating enums with an UDA. Some DMD tests need restarting because of download failure. |
9il
reviewed
Sep 26, 2022
| value = to!T(move(temporal)); | ||
| static if (hasUDA!(T, serdeProxyCast)) | ||
| { | ||
| static if (__traits(compiles, ()@safe{return cast(T)move(temporal);})) |
Member
There was a problem hiding this comment.
cast(T)move ( ... <- move is useless when cast. Please remove
| { | ||
| serializer.serializeWithProxy!(serdeGetProxy!V)(value); | ||
| static if (hasUDA!(V, serdeProxyCast)) | ||
| serializeValue(serializer, cast(serdeGetProxy!V)value); |
Member
There was a problem hiding this comment.
The cast may return by value. serializeValue may want a reference.
| static if (hasUDA!(V, serdeProxyCast)) | ||
| serializeValue(serializer, cast(serdeGetProxy!V)value); | ||
| else | ||
| serializer.serializeWithProxy!(serdeGetProxy!V)(value); |
Member
There was a problem hiding this comment.
serializeWithProxy has to be updated instead with all its calls and test for them. Please add tests for those cases too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
depends on libmir/mir-algorithm#408