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 1d/2d array method error message with unsupported keyword arg #36325

Merged
merged 3 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function showerror(io::IO, ex::MethodError)
hasrows |= isrow
push!(vec_args, isrow ? vec(arg) : arg)
end
if hasrows && applicable(f, vec_args...)
if hasrows && applicable(f, vec_args...) && isempty(kwargs)
Moelf marked this conversation as resolved.
Show resolved Hide resolved
print(io, "\n\nYou might have used a 2d row vector where a 1d column vector was required.",
"\nNote the difference between 1d column vector [1,2,3] and 2d row vector [1 2 3].",
"\nYou can convert to a column vector with the vec() function.")
Expand Down
9 changes: 9 additions & 0 deletions test/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,12 @@ end
@test contains(bt_str, "@ $m.B.C")
@test contains(bt_str, "@ $m.B.D")
end
# 1d/2d error shouldn't appear in unsupported keywords arg #36325
let err = nothing
try
identity([1 1]; bad_kwards = :julia)
catch err
err_str = sprint(showerror, err)
@test !occursin("2d", err_str)
end
end