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
Prioritize Non-Generic methods #815
Prioritize Non-Generic methods #815
Conversation
@@ -60,6 +60,17 @@ private static MethodDescriptor[] Prioritize(MethodDescriptor[] descriptors) | |||
{ | |||
static int CreateComparison(MethodDescriptor d1, MethodDescriptor d2) | |||
{ | |||
// if its a generic method, put it on the end | |||
if (d1.Method.IsGenericMethod) |
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.
This is not stable and could potentially create infinite loops with some sort algorithm. The idea being that (a, b) might then be compared again with (b, a) and both would return opposite values if a == b.
If think the test should be that if d1 is generic and not d2, then put it at the end.
// put params versions to end, they can be tricky to match and can cause trouble / extra overhead | ||
if (d1.HasParams) | ||
{ |
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.
Isn't then there the same problem with potentially infinite loops?
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.
Probably. This is an issue I found while working on Array.Sort this week. Can you fix it too ?
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.
off course, i just wanted to ask before
As mentioned in #814 Generic Methods will now be last in order.
Prevents invoking the Generic Method instead of the Non-Generic Method of same name, if the Generic Method is declared before.
fixes #814