moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
http://www.moonsharp.org
Other
1.41k stars 213 forks source link

Shouldn't EXACT_MATCH score higher than CUSTOM_CONVERTER_MATCH? #294

Open oxysoft opened 3 years ago

oxysoft commented 3 years ago

I noticed something strange about MoonSharp while debugging a bug in our game. Both of these weights for overload resolving are calibrated to 100:

https://github.com/moonsharp-devs/moonsharp/blob/4e748a7a74af04b589af1b3e1aaa2d66d8b36a57/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/Converters/ScriptToClrConversions.cs#L9Ohttps://github.com/moonsharp-devs/moonsharp/blob/4e748a7a74af04b589af1b3e1aaa2d66d8b36a57/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/Converters/ScriptToClrConversions.cs#L9-L10

Shouldn't an exact match score higher? Otherwise, this can cause ScriptRuntimeException due to argument mismatch (cannot convert X to a CLR Y etc.) when adding custom converters for UserData to UserData. (userdata to another userdata)