elm-format icon indicating copy to clipboard operation
elm-format copied to clipboard

elm-format causes “UNFINISHED PARENTHESES” compiler error

Open lydell opened this issue 2 years ago • 0 comments

This is valid according to Elm 0.19.1:

module Main exposing (main)

import Html


main =
    let
        text =
            String.toUpper
                (String.trim """
Hello!
"""
            )
    in
    Html.text text

elm-format 0.8.5 turns that into:

module Main exposing (main)

import Html


main =
    let
        text =
            String.toUpper
                (String.trim """
Hello!
""")
    in
    Html.text text

Diff:

             String.toUpper
                 (String.trim """
 Hello!
-"""
-            )
+""")
     in
     Html.text text

Trying to compile that, Elm reports this error:

-- UNFINISHED PARENTHESES ----------------------------------------- src/Main.elm

I was expecting to see a closing parenthesis next:

10|                 (String.trim """
11| Hello!
12| """)
       ^
Try adding a ) to see if that helps!

Note: I can get confused by indentation in cases like this, so maybe you have a
closing parenthesis but it is not indented enough?

Workaround:

module Main exposing (main)

import Html


main =
    let
        text =
            String.toUpper <|
                String.trim """
Hello!
"""
    in
    Html.text text

lydell avatar Oct 08 '21 15:10 lydell