Skip to content

Commit 683f6da

Browse files
kritzcreekgaryb
authored andcommitted
throw IntOutOfRange error with position information if present (purescript#3210)
1 parent 8369db4 commit 683f6da

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • src/Language/PureScript/CodeGen

src/Language/PureScript/CodeGen/JS.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import Language.PureScript.CoreImp.Optimizer
3232
import Language.PureScript.CoreFn
3333
import Language.PureScript.Crash
3434
import Language.PureScript.Errors (ErrorMessageHint(..), SimpleErrorMessage(..),
35-
MultipleErrors(..), rethrow,
36-
errorMessage, rethrowWithPosition, addHint)
35+
MultipleErrors(..), rethrow, errorMessage,
36+
errorMessage', rethrowWithPosition, addHint)
3737
import Language.PureScript.Names
3838
import Language.PureScript.Options
3939
import Language.PureScript.PSString (PSString, mkString)
@@ -423,10 +423,10 @@ moduleToJs (Module coms mn _ imps exps foreigns decls) foreign_ =
423423
-- the value is `Unary Negate (NumericLiteral (Left 2147483648))`, and
424424
-- 2147483648 is larger than the maximum allowed int.
425425
return $ AST.NumericLiteral ss (Left (-i))
426-
go js@(AST.NumericLiteral _ (Left i)) =
426+
go js@(AST.NumericLiteral ss (Left i)) =
427427
let minInt = -2147483648
428428
maxInt = 2147483647
429429
in if i < minInt || i > maxInt
430-
then throwError . errorMessage $ IntOutOfRange i "JavaScript" minInt maxInt
430+
then throwError . maybe errorMessage errorMessage' ss $ IntOutOfRange i "JavaScript" minInt maxInt
431431
else return js
432432
go other = return other

0 commit comments

Comments
 (0)