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

Bad error message when calling keyword-less constructors with keywords #17207

Closed
mauro3 opened this issue Jun 30, 2016 · 1 comment
Closed

Bad error message when calling keyword-less constructors with keywords #17207

mauro3 opened this issue Jun 30, 2016 · 1 comment
Labels
error handling Handling of exceptions by Julia or the user keyword arguments f(x; keyword=arguments)

Comments

@mauro3
Copy link
Contributor

mauro3 commented Jun 30, 2016

This is confusing (on 0.5, but similarly confusing on 0.4):

julia> type A end

julia> A(t=7)
ERROR: MethodError: no method matching (::Core.#kw#Type)(::Array{Any,1}, ::Type{A})
Closest candidates are:
  Type(::Array{Any,1}, ::Type{Base.LibGit2.FetchOptions})
  Type(::Array{Any,1}, ::Type{Base.LibGit2.CloneOptions})
  Type(::Array{Any,1}, ::Type{Base.LibGit2.DiffOptionsStruct})
  ...
 in eval(::Module, ::Any) at ./boot.jl:234
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

whereas for functions the error is good:

julia> f(x) = x
f (generic function with 1 method)

julia> f(t=5)
ERROR: ArgumentError: function f does not accept keyword arguments
@JeffBezanson JeffBezanson added the error handling Handling of exceptions by Julia or the user label Jun 30, 2016
@JeffBezanson JeffBezanson added the keyword arguments f(x; keyword=arguments) label Jul 20, 2017
@JeffBezanson
Copy link
Member

Fixed by #16669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user keyword arguments f(x; keyword=arguments)
Projects
None yet
Development

No branches or pull requests

2 participants