Open NetDefender opened 3 years ago
This seems unlikely, although I think your change is a good one. In your example, the "score" for converting an Int to a Decimal is 5. Converting two Int32 to Decimal would give a SUM of 10, and then divided by 2 is 5. The score on the second one would be 5, not 0. For this to be an issue, there would either need to be a lot more parameters or the conversion would be much closer than int->decimal. An Int32 -> UInt32, for example, only returns 1, and if just one of the arguments was not a match, then you'd hit the integer rounding.
Did you actually have a test case where the wrong method was getting called?
Hi, This is a wonderful library. I have problem with method overloads and i have seen how to correct it. In the image below, the result of the division on ComputeScoreInternal should be a float, if not there are duplicates in score. ComputeSum is working fine but the division after is coercing the value to int, so If i call the function MyFunc(1,1):
void MyFunc(int a, int b);
=> 0 Scorevoid MyFunc(decimal a, decimal b
=> 0 Score WrongThey are returning the same score.
Wrong:![Before](https://user-images.githubusercontent.com/2451916/99266381-fc30fc80-2822-11eb-931d-66c5c92138c3.png)
Right:![After](https://user-images.githubusercontent.com/2451916/99266411-05ba6480-2823-11eb-83b7-be2204b7f95a.png)