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

Unexpected 1d/2d array method error message with unsupported keyword argument #36321

Open
tkf opened this issue Jun 17, 2020 · 2 comments
Open
Labels
error messages Better, more actionable error messages

Comments

@tkf
Copy link
Member

tkf commented Jun 17, 2020

I couldn't find any issue tracking this:

julia> identity([1 1]; unsupported = :keyword)
ERROR: MethodError: no method matching identity(::Array{Int64,2}; unsupported=:keyword)

You might have used a 2d row vector where a 1d column vector was required.
Note the difference between 1d column vector [1,2,3] and 2d row vector [1 2 3].
You can convert to a column vector with the vec() function.
Closest candidates are:
  identity(::Any) at operators.jl:511 got unsupported keyword argument "unsupported"

This seems to happen only with keyword arguments:

julia> identity([1 1], nothing)
ERROR: MethodError: no method matching identity(::Array{Int64,2}, ::Nothing)
Closest candidates are:
  identity(::Any) at operators.jl:511
@tkf tkf added the error messages Better, more actionable error messages label Jun 17, 2020
@Moelf
Copy link
Contributor

Moelf commented Jun 17, 2020

this fix may be imperfect if somehow it was a 1d/2d method error && keywords are presented? But in that case I assume user can remove the unsupported keyword and then see the 1d/2d error, so this is fine.

@tkf
Copy link
Member Author

tkf commented Jun 17, 2020

Wow, that's a super quick fix :) Yeah, agree about that the user can remove the unsupported keyword argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Better, more actionable error messages
Projects
None yet
Development

No branches or pull requests

2 participants