Skip to content

feat: .net 8 and github issue 311#313

Merged
davideicardi merged 3 commits intomasterfrom
feat/net-8-and-github-issue-311
Aug 19, 2024
Merged

feat: .net 8 and github issue 311#313
davideicardi merged 3 commits intomasterfrom
feat/net-8-and-github-issue-311

Conversation

@davideicardi
Copy link
Copy Markdown
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 requested a review from metoule as a code owner August 11, 2024 17:03
@davideicardi davideicardi removed the request for review from metoule August 11, 2024 17:04
@davideicardi davideicardi requested a review from metoule August 11, 2024 17:16
@davideicardi davideicardi merged commit c6835e3 into master Aug 19, 2024
@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