-
-
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
Fix specificity with bound varargs #16249
Conversation
@@ -884,41 +884,6 @@ jl_typemap_entry_t *jl_typemap_insert(union jl_typemap_t *cache, jl_value_t *par | |||
return newrec; | |||
} | |||
|
|||
JL_DLLEXPORT int jl_args_morespecific(jl_value_t *a, jl_value_t *b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, +1 to moving this code.
I'm wondering whether we want this in light of #16276 (comment). Perhaps we should force the user to write out the |
bump. this just needs the typo fix I mentioned above to |
b5f2329
to
9614c40
Compare
OK, fixed. I was hesitant because, thinking in terms of a future world where subtyping and method specificity is decided in a diagonally-aware manner, I am somewhat skeptical that our current specificity heuristics will be sustainable. But this stage of julia-0.5 is not the time to worry about such things. |
This seems to have caused a segfault
Repro Direct repro BT
The issue seems to be a OOB access in
in |
Thanks for the detective work as usual, @yuyichao. |
In #11242 (comment), the following example was shown to exhibit a method-sorting bug:
In cases where one signature is a bound-length vararg and the other has specified length, this PR fixes the length of the vararg before deciding specificity, provided that doing so also narrows the type of an earlier argument.
Something along these lines appears necessary to ensure that the specificity computation operates over just the domain of intersection of the two methods. Whether this is the right implementation is a separate question.