Skip to content

Commit 23b72f8

Browse files
author
winter
committed
fix tests
1 parent 21c2083 commit 23b72f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Z/Data/Parser/Numeric.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ int = "Z.Data.Parser.Numeric.int" <?> do
198198
bs <- P.takeWhile1 isDigit
199199
if V.length bs <= INT64_MAX_DIGITS_LEN
200200
then do
201-
let i64 = decLoop @Int64 0 bs
202-
if i64 <= negate (fromIntegral (minBound :: a))
203-
then return (fromIntegral (negate i64))
201+
let i64 = negate (decLoop @Int64 0 bs)
202+
if i64 >= fromIntegral (minBound :: a)
203+
then return (fromIntegral i64)
204204
else P.fail' "decimal numeric value overflow"
205205
else do
206-
let i64 = decLoop @Integer 0 bs
207-
if i64 <= negate (fromIntegral (minBound :: a))
208-
then return (fromIntegral (negate i64))
206+
let i64 = negate (decLoop @Integer 0 bs)
207+
if i64 >= fromIntegral (minBound :: a)
208+
then return (fromIntegral i64)
209209
else P.fail' "decimal numeric value overflow"
210210

211211
-- | Same with 'int', but sliently cast if overflow happens.

0 commit comments

Comments
 (0)