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

feat: .net 8 and github issue 311 #313

Merged
merged 3 commits into from
Aug 19, 2024

Conversation

davideicardi
Copy link
Member

@davideicardi davideicardi commented Aug 11, 2024

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.

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)"));

@davideicardi davideicardi removed the request for review from metoule August 11, 2024 17:04
@davideicardi davideicardi merged commit c6835e3 into master Aug 19, 2024
2 checks passed
@davideicardi davideicardi deleted the feat/net-8-and-github-issue-311 branch August 19, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants