Skip to content

Elm format changes large integer literals #635

@harrysarson

Description

@harrysarson

The following elm code:

module Main exposing (toWrite)


largeInt: Int
largeInt=
    1000000000000000000000

is is changed by elm-format as such:

--- a/Main.elm
+++ b/Main.elm
@@ -3,4 +3,4 @@ module Main exposing (toWrite)
 
 toWrite : String
 toWrite =
-    String.fromInt 1000000000000000000000
+    String.fromInt 3875820019684212736

The code is malformed anyway due to elm/compiler#1246 but this will become a problem as and when the elm compiler generates correct code for this. The underlying issue is the AST uses too small an integer datatype.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions