Elm Exactly
Results / elm /

CompilerIssue1947MultilineStringInLetBinopTest

Tags:elm19-bugelm-spec-contradicts

XFAIL Expected to fail: under the layout rule the ++ begins left of the let definitions, so the program is rejected

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/compiler#1947

A multi-line string whose closing quotes are left of the `let` body cannot be followed by an operator.

<https://github.com/elm/compiler/issues/1947>

The closing `"""` of a multi-line string in a let binding sits in column 1, and Elm 0.19.1
rejects the `++` that follows it with a parse error. The program is valid; it should compile and
log the string, a newline followed by `!`.

A Standard Definition of Elm? does not accept this as a bug. Under the layout rule every item of
a phrase is indented, and only the column at which an item begins counts (restriction
core-layout-rule): the `++` begins in column 5, left of the column of `someString`, under which
the definitions of the `let` are read, so it cannot continue the definition, and the program is
rejected, as Elm 0.19.1 rejects it.
<https://elm-test-suite.netlify.app/standard/restrictions/core-layout-rule>

Results

elm-0.19.1

fail
compile failed (exit 1):
Dependencies ready!
Compiling ...-- LET PROBLEM ---------- src/CompilerIssue1947MultilineStringInLetBinopTest.elm

I was partway through parsing a `let` expression, but I got stuck here:

28|     let
29|         someString =
30|             """
31| """ ++ "!"
        ^
Based on the indentation, I was expecting to see the in keyword next. Is there a
typo?

Note: This can also happen if you are trying to define another value within the
`let` but it is not indented enough. Make sure each definition has exactly the
same amount of spaces before it. They should line up exactly!

Detected problems in 1 module.

elm-0.19.2

fail
compile failed (exit 1):
Dependencies ready!
Compiling ...-- LET PROBLEM ---------- src/CompilerIssue1947MultilineStringInLetBinopTest.elm

I was partway through parsing a `let` expression, but I got stuck here:

28|     let
29|         someString =
30|             """
31| """ ++ "!"
        ^
Based on the indentation, I was expecting to see the in keyword next. Is there a
typo?

Note: This can also happen if you are trying to define another value within the
`let` but it is not indented enough. Make sure each definition has exactly the
same amount of spaces before it. They should line up exactly!

Detected problems in 1 module.

elm-0.19.3

fail
compile failed (exit 1):
Dependencies ready!
Compiling ...-- LET PROBLEM ---------- src/CompilerIssue1947MultilineStringInLetBinopTest.elm

I was partway through parsing a `let` expression, but I got stuck here:

28|     let
29|         someString =
30|             """
31| """ ++ "!"
        ^
Based on the indentation, I was expecting to see the in keyword next. Is there a
typo?

Note: This can also happen if you are trying to define another value within the
`let` but it is not indented enough. Make sure each definition has exactly the
same amount of spaces before it. They should line up exactly!

Detected problems in 1 module.

lamdera-1.5.0

fail
compile failed (exit 1):
Dependencies ready!
Detected problems in 1 module.
-- LET PROBLEM ---------- src/CompilerIssue1947MultilineStringInLetBinopTest.elm

I was partway through parsing a `let` expression, but I got stuck here:

28|     let
29|         someString =
30|             """
31| """ ++ "!"
        ^
Based on the indentation, I was expecting to see the in keyword next. Is there a
typo?

Note: This can also happen if you are trying to define another value within the
`let` but it is not indented enough. Make sure each definition has exactly the
same amount of spaces before it. They should line up exactly!

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/CompilerIssue1947MultilineStringInLetBinopTest] in its title.

Source

The -- CHECK: lines give the expected output.

module CompilerIssue1947MultilineStringInLetBinopTest exposing (..)
{-| A multi-line string whose closing quotes are left of the `let` body cannot be followed by an operator.
<https://github.com/elm/compiler/issues/1947>
The closing `"""` of a multi-line string in a let binding sits in column 1, and Elm 0.19.1
rejects the `++` that follows it with a parse error. The program is valid; it should compile and
log the string, a newline followed by `!`.
A Standard Definition of Elm? does not accept this as a bug. Under the layout rule every item of
a phrase is indented, and only the column at which an item begins counts (restriction
core-layout-rule): the `++` begins in column 5, left of the column of `someString`, under which
the definitions of the `let` are read, so it cannot continue the definition, and the program is
rejected, as Elm 0.19.1 rejects it.
<https://elm-test-suite.netlify.app/standard/restrictions/core-layout-rule>
-}
-- TAGS: elm19-bug, elm-spec-contradicts
-- XFAIL: under the layout rule the ++ begins left of the let definitions, so the program is rejected
-- CHECK: someString: "\n!"
import Html exposing (text)
main =
let
someString =
"""
""" ++ "!"
_ =
Debug.log "someString" someString
in
text "done"