Open
Description
Under most cases when working with UInt16 and Int16 types seem to have a bug saying it didn't receive what it expected even though the exception actually says it did receive the correct type.
I thought the casting of the input value before going into the runtime would help, but it didn't. Maybe there is some way for me to cast in the script that makes this work, but I tried that and was unable to fix the issue.
If there are any workarounds I could use in the meantime, please let me know.
Results from the following scripts
DoubleToDouble(input): Output out@2:Real = 2
FloatToFloat(input): Output out@2:Real = 2
Int32ToInt32(input): Output out@2:Int32 = 2
UInt32ToUInt32(input): Output out@2:UInt32 = 2
Int16ToInt16(input): Output out@2:Int16 = 2
UInt16ToUInt16(input): Output out@2:UInt16 = 2
DoubleToDouble(input + input): Output out@2:Real = 4
FloatToFloat(input + input): Output out@2:Real = 4
Int32ToInt32(input + input): Output out@2:Int32 = 4
UInt32ToUInt32(input + input): Output out@2:UInt32 = 4
Int16ToInt16(input + input): Unhandled exception. [FU783] Invalid function call argument: Int16ToInt16(Int16)->Int16. Expected: Int16, but was: Int16
UInt16ToUInt16(input + input): Unhandled exception. [FU783] Invalid function call argument: UInt16ToUInt16(UInt16)->UInt16. Expected: UInt16, but was: UInt16
public static void Main()
{
string script = "UInt16ToUInt16(input + input)";
var runtime = Funny.Hardcore
.WithFunction(nameof(DoubleToDouble), (double number) => DoubleToDouble(number))
.WithFunction(nameof(FloatToFloat), (float number) => FloatToFloat(number))
.WithFunction(nameof(Int32ToInt32), (Int32 number) => Int32ToInt32(number))
.WithFunction(nameof(UInt32ToUInt32), (UInt32 number) => UInt32ToUInt32(number))
.WithFunction(nameof(Int16ToInt16), (Int16 number) => Int16ToInt16(number))
.WithFunction(nameof(UInt16ToUInt16), (UInt16 number) => UInt16ToUInt16(number))
.Build(script);
runtime["input"].Value = (UInt16)2;
runtime.Run();
Console.WriteLine(runtime["out"]);
}
private static double DoubleToDouble(double number) => number;
private static float FloatToFloat(float number) => number;
private static Int32 Int32ToInt32(Int32 number) => number;
private static UInt32 UInt32ToUInt32(UInt32 number) => number;
private static Int16 Int16ToInt16(Int16 number) => number;
private static UInt16 UInt16ToUInt16(UInt16 number) => number;