-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
incorrect dispatch with invoke on methods with default arguments #9938
Comments
This makes some sort of sense based on the implementation of default arguments. f(i::Number, o::Int64) = println("Number")
f(i::Number) = f(i, 1) which is why f(i::Number, o::Int64) = println("Number")
f(i::Number) = invoke(f, (Number, Int64), i) although we'd need #9642 for this to perform well, and it would be a breaking change, since a different method would be called for: f(i::Int64, o::Int64) = println("Int64")
f(i::Number, o::Int64=1) = println("Number")
f(1) For #9575 it seems like the tests that use |
i believe @simonster's solution is correct. might need to search back through the issues to make sure there wasn't specific concerns with it. i think the previous concern was that it would change the behavior of: f(x::Int, y::String=2) = 1
f(x::Int, y) = 2 which is valid under the current rules (where |
@simonster good point, I changed the test it works now. |
More or less a duplicate of #7357. In that issue the solution of lowering default arguments to use |
Closing as dup. |
see image below, this works correctly if no keyword arguments are used. This is causing the current test failures of #9575
The text was updated successfully, but these errors were encountered: