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

JsonSerializer.writeValue should accept immutable/const values #1109

Merged
merged 1 commit into from
Jun 11, 2015
Merged

JsonSerializer.writeValue should accept immutable/const values #1109

merged 1 commit into from
Jun 11, 2015

Conversation

japplegame
Copy link
Contributor

No description provided.

@s-ludwig
Copy link
Member

Since T is a template type, it should usually be inferred to const/immutable just fine. If you have any failing case, can you add that as a unit test?

@japplegame
Copy link
Contributor Author

serialization fails if immutable / const class has toJson / fromJson methods.
Caused by this line: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/data/serialization.d#L308
Perhaps it will be better to change serialization.d instead json.d:
serializer.writeValue!TU(value) -> serializer.writeValue!T(value).

@s-ludwig
Copy link
Member

Okay, I've taken another look and I think this is the safest fix. I'll merge and add a unit test.

s-ludwig added a commit that referenced this pull request Jun 11, 2015
JsonSerializer.writeValue should accept immutable/const values
@s-ludwig s-ludwig merged commit c840a82 into vibe-d:master Jun 11, 2015
s-ludwig added a commit that referenced this pull request Jun 11, 2015
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