diff --git a/src/System.Linq.Dynamic.Core/Parser/NumberParser.cs b/src/System.Linq.Dynamic.Core/Parser/NumberParser.cs index 798ff097..f4bbc731 100644 --- a/src/System.Linq.Dynamic.Core/Parser/NumberParser.cs +++ b/src/System.Linq.Dynamic.Core/Parser/NumberParser.cs @@ -149,7 +149,7 @@ public Expression ParseIntegerLiteral(int tokenPosition, string text) throw new ParseException(Res.MinusCannotBeAppliedToUnsignedInteger, tokenPosition); } - if (value <= int.MaxValue) + if (value >= int.MinValue && value <= int.MaxValue) { return _constantExpressionHelper.CreateLiteral((int)value, textOriginal); } diff --git a/test/System.Linq.Dynamic.Core.Tests/Parser/NumberParserTests.cs b/test/System.Linq.Dynamic.Core.Tests/Parser/NumberParserTests.cs index f8ccc496..2f8a8ed8 100644 --- a/test/System.Linq.Dynamic.Core.Tests/Parser/NumberParserTests.cs +++ b/test/System.Linq.Dynamic.Core.Tests/Parser/NumberParserTests.cs @@ -1,8 +1,8 @@ -using FluentAssertions; using System.Collections.Generic; using System.Globalization; using System.Linq.Dynamic.Core.Parser; using System.Linq.Expressions; +using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests.Parser; @@ -129,6 +129,8 @@ public void NumberParser_ParseNumber_Double(string? culture, string text, double [Theory] [InlineData("42", 42)] [InlineData("-42", -42)] + [InlineData("3000000000", 3000000000)] + [InlineData("-3000000000", -3000000000)] [InlineData("77u", 77)] [InlineData("77l", 77)] [InlineData("77ul", 77)]