var interpreter2 = new Interpreter().SetDefaultNumberType(DefaultNumberType.Decimal);
interpreter2.SetVariable("a", a);
// expected to throw because Substring is not defined for decimal
Assert.Throws<NoApplicableMethodException>(() => interpreter2.Eval("a.Substring(0, 2)"));
// It works if we cast to int
Assert.AreEqual("AA", interpreter2.Eval("a.Substring((int)0, (int)2)"));
Configured .NET runtime 8.0, removed support for .NET 3.1.
Close #311: Add a test to demostrate that it is not a bug.
Substring
method in .NET (https://learn.microsoft.com/en-us/dotnet/api/system.string.substring?view=net-8.0#system-string-substring(system-int32-system-int32)) it is not defined for Decimal type, so if we force all types to be decimal it will not work unless you perform a cast to int.