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 #20108 fix #20111: method display errors #20119

Merged
merged 2 commits into from
Jan 22, 2017

Conversation

ihnorton
Copy link
Member

@ihnorton ihnorton commented Jan 19, 2017

Both errors from trying to access fields of ::UnionAll objects.
replutil seems to be reasonably well-tested already, but hit some corner cases here.

@tkelman
Copy link
Contributor

tkelman commented Jan 19, 2017

can we test these under a fake repl output, if the corner cases only happen in interactive display?

@ararslan ararslan added domain:display and printing Aesthetics and correctness of printed representations of objects. domain:types and dispatch Types, subtyping and method dispatch labels Jan 19, 2017
@@ -515,6 +515,7 @@ function show_method_candidates(io::IO, ex::MethodError, kwargs::Vector=Any[])
# If the methods args is longer than input then the method
# arguments is printed as not a match
for (k, sigtype) in enumerate(sig[length(t_i)+1:end])
sigtype = unwrap_unionall(sigtype)
Copy link
Sponsor Member

@JeffBezanson JeffBezanson Jan 20, 2017

Choose a reason for hiding this comment

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

I think this should only be done in the isvarargtype case. Otherwise we won't correctly show argument types that are UnionAlls.

This code also doesn't seem to handle arguments written as ::Vararg{T,N}, but that's a separate pre-existing issue.

@ihnorton
Copy link
Member Author

Updated. Added tests.

# Issue 20111
let K20111(x) = y -> x, buf = IOBuffer()
show(buf, methods(K20111(1)))
@test contains(String(buf), " 1 method for generic function")
Copy link
Contributor

Choose a reason for hiding this comment

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

4-space

@Keno Keno dismissed JeffBezanson’s stale review January 22, 2017 02:47

Changes addressed.

Copy link
Member

@Keno Keno left a comment

Choose a reason for hiding this comment

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

LGTM once the whitespace change requested by @tkelman is addressed.

@ihnorton ihnorton merged commit b44faa3 into JuliaLang:master Jan 22, 2017
@ihnorton ihnorton deleted the fixes_20108_20111 branch January 22, 2017 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:display and printing Aesthetics and correctness of printed representations of objects. domain:types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants