Skip to content

Compiler can't parse multi-line strings in a binary expression inside a let #1947

Open
@jfmengels

Description

@jfmengels

Quick Summary: I found that the compiler can't parse the code containing a let in declaration whose value is a binary expression where the first element is a multi-line string, if the multi-line string has its closing """ appearing in a column before the column of the in keyword.

SSCCE

module Main exposing (..)

variable =
    let
        someString =
            """
""" ++ ""
    in
    ""
  • Elm: 0.19.0
  • Browser: Not applicable
  • Operating System: Ubuntu 18.04

Additional Details

For the SSCCE above, I'm getting the following error:

Something went wrong while parsing someString's definition.

5|         someString =
6|             """
7| """ ++ ""
       ^
I was expecting:

  - an argument, like `name` or `total`
  - the `in` keyword
  - the rest of someString's definition. Maybe you forgot some code? Or maybe
    the body of `someString` needs more indentation? (Try 10+ spaces.)

The following also doesn't work (the ending """ is now aligned with let and in)

module Main exposing (..)

variable =
    let
        someString =
            """
    """ ++ ""
    in
    ""

but the following compiles just fine (the ending """ is now more indented than let and in):

module Main exposing (..)

variable =
    let
        someString =
            """
     """ ++ ""
    in
    ""

The first example works fine if the variables is moved out of the let in construct.

module Main exposing (..)

someString =
            """
""" ++ ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions