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

Check for unused keyword arguments #270

Open
jonniedie opened this issue Jun 5, 2020 · 0 comments
Open

Check for unused keyword arguments #270

jonniedie opened this issue Jun 5, 2020 · 0 comments

Comments

@jonniedie
Copy link

jonniedie commented Jun 5, 2020

Only positional arguments are currently checked. It might also be worth adding an extra stern warning for unused keyword argument slurps, because they can cause silent failures on misspelled keyword arguments:

julia> badfun(;some_arg=1, another_arg=2, kwargs...) = some_arg*another_arg^2
badfun (generic function with 1 method)

julia> badfun(;another_arg=5)
25

julia> badfun(;anotherarg=5)
4

julia> betterfun(;some_arg=1, another_arg=2) = some_arg*another_arg^2
betterfun (generic function with 1 method)

julia> betterfun(;another_arg=5)
25

julia> betterfun(;anotherarg=5)
ERROR: MethodError: no method matching betterfun(; anotherarg=5)
Closest candidates are:
  betterfun(; some_arg, another_arg) at REPL[2]:1 got unsupported keyword argument "anotherarg"
Stacktrace: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant