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

The short parameter is incorrectly converted when there are optional parameters. #1994

Open
sigeer opened this issue Nov 1, 2024 · 0 comments

Comments

@sigeer
Copy link

sigeer commented Nov 1, 2024

Version used

4.1.0

Describe the bug

The short parameter is incorrectly converted when there are optional parameters.

To Reproduce

using Jint;

var test = new Test();

Engine je = new Engine();
je.SetValue("test", test);
je.Execute(@"
                test.Method1(1);
            ");
// print "2"
Console.ReadLine();


public class Test
{
    public void Method1(short s, bool b = true)
    {
        Console.WriteLine("1");
    }

    // or string b
    public void Method1(bool b)
    {
        Console.WriteLine("2");
    }
}

Expected behavior

print "1"

Additional context

if short => int (int s, bool b = true)

    public void Method1(int s, bool b = true)
    {
        Console.WriteLine("1");
    }

will print "1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant