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

Incorrect resolution with methods with params[] array #214

Closed
metoule opened this issue Dec 18, 2021 · 0 comments · Fixed by #215
Closed

Incorrect resolution with methods with params[] array #214

metoule opened this issue Dec 18, 2021 · 0 comments · Fixed by #215
Assignees

Comments

@metoule
Copy link
Contributor

metoule commented Dec 18, 2021

This is a regression due to my PR #193. When there are two overloads that have the same arguments except for the params array, calling the method without the array leads to the improper method to be chosen.

internal static class Utils
{
  public static int WithParamsArray2(string str, Exception e) => 6;
  public static int WithParamsArray2(string str, Exception e, params string[] args) => 7;
}

var target = new Interpreter();
target.Reference(typeof(Utils));

var str = "str";
var e = new Exception();
target.SetVariable("str", str);
target.SetVariable("e", e);

// incorrectly uses the overload with the params array
Assert.AreEqual(6, target.Eval("Utils.WithParamsArray2(str, e)"));
Assert.AreEqual(7, target.Eval("Utils.WithParamsArray2(str, e, str, str)"));
@metoule metoule self-assigned this Dec 18, 2021
metoule added a commit to metoule/DynamicExpresso that referenced this issue Dec 18, 2021
metoule added a commit that referenced this issue Dec 19, 2021
* Fix incorrect overload resolution when two overloads differ only by a params array argument.
Fixes #214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant