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

fix incorrect show for Pair #28327

Merged
merged 2 commits into from
Jul 29, 2018
Merged

fix incorrect show for Pair #28327

merged 2 commits into from
Jul 29, 2018

Conversation

rfourquet
Copy link
Member

E.g. show(Dict(Pair{Integer,Integer}(1,2) => 3)) was producing
Dict(1=>2=>3), i.e. a pair of parenthesis was missing.

E.g. show(Dict(Pair{Integer,Integer}(1,2) => 3)) was producing
Dict(1=>2=>3), i.e. a pair of parenthesis was missing.
@rfourquet rfourquet added bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. labels Jul 28, 2018
base/show.jl Outdated
isdelimited(iocompact, p.first) || print(io, "(")
show(IOContext(iocompact, :typeinfo => typeinfos[1]), p.first)
isdelimited(iocompact, p.first) || print(io, ")")
io1, io2 = (IOContext(iocompact, :typeinfo => ti) for ti in gettypeinfos(io, p))
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Could you rewrite this without the generator? It seems silly to use it for exactly 2 items.

Copy link
Member Author

Choose a reason for hiding this comment

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

is the for loop better?

@JeffBezanson JeffBezanson merged commit 8e8ee24 into master Jul 29, 2018
@JeffBezanson JeffBezanson deleted the rf/show/fixpair branch July 29, 2018 16:43
KristofferC added a commit that referenced this pull request Jul 29, 2018
KristofferC pushed a commit that referenced this pull request Feb 11, 2019
E.g. show(Dict(Pair{Integer,Integer}(1,2) => 3)) was producing
Dict(1=>2=>3), i.e. a pair of parenthesis was missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants