Fix Issue 7879 - format of const class with non const toString()#6207
Merged
wilzbach merged 2 commits intodlang:masterfrom Feb 28, 2018
Merged
Fix Issue 7879 - format of const class with non const toString()#6207wilzbach merged 2 commits intodlang:masterfrom
wilzbach merged 2 commits intodlang:masterfrom
Conversation
Contributor
|
Thanks for your pull request, @JackStouffer! Bugzilla references
|
f62725f to
1a6da53
Compare
Contributor
Author
|
Changed code to match std.format's existing behavior for class formatting |
1a6da53 to
502aed8
Compare
Contributor
Yeah, though we should really move things out of |
wilzbach
reviewed
Feb 23, 2018
| { | ||
| class F | ||
| { | ||
| override string toString() const @safe |
Contributor
There was a problem hiding this comment.
BTW we can't use inout here: https://issues.dlang.org/show_bug.cgi?id=18500
wilzbach
approved these changes
Feb 23, 2018
| else | ||
| { | ||
| static if (hasToString!(T, Char) > 1 || (!isInputRange!T && !is(BuiltinTypeOf!T))) | ||
| static if ((is(T == immutable) || is(T == const) || is(T == shared)) && hasToString!(T, Char) == 0) |
Contributor
There was a problem hiding this comment.
I would prefer if we could use == none here.
See: #6209
| put(w, typeid(Unqual!T).name); | ||
| put(w, ')'); | ||
| } | ||
| else static if (hasToString!(T, Char) > 1 || !isInputRange!T && !is(BuiltinTypeOf!T)) |
Contributor
There was a problem hiding this comment.
With #6209: !overload.among(none, hasSomeToString)
Contributor
Author
|
Moving ahead with this to shorten the queue. |
Contributor
Author
|
@wilzbach Can I get a manual merge? |
This was referenced Feb 20, 2025
Merged
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.
So trying to make
Object.toStringconst was a nightmare, so I added in this work-around to at least allow the code to compile.