Elm Exactly
Results / elm-error-catalogue /

ErrorMessage2302NameClashListPatternWhitespaceTest

Tags:elm19-bug-fixerror-message

elm-0.19.1 failelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass

Issue: elm/compiler#2302

The NAME CLASH report for a list pattern `[ a, a ]` prints 65532 spaces.

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

The report should underline the two `a`s on the code line. Elm 0.19.1 prints the first caret,
then 65532 spaces before the second one.

Fixed in Elm 0.19.2.

Results

elm-0.19.1

fail
Unexpected pattern (CHECK-NOT): {{ {200}[ ]}}
--- compiler output ---
Compiling ...-- NAME CLASH ------- src/ErrorMessage2302NameClashListPatternWhitespaceTest.elm

This `case` pattern has multiple `a` variables.

25|         [ a, a ] ->
                 ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

elm-0.19.2

pass
Output
Compiling ...-- NAME CLASH ------- src/ErrorMessage2302NameClashListPatternWhitespaceTest.elm

This `case` pattern has multiple `a` variables.

24|         [ a, a ] ->
              ^  ^
How can I know which one you want? Rename one of them!

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- NAME CLASH ------- src/ErrorMessage2302NameClashListPatternWhitespaceTest.elm

This `case` pattern has multiple `a` variables.

24|         [ a, a ] ->
              ^  ^
How can I know which one you want? Rename one of them!

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- NAME CLASH ------- src/ErrorMessage2302NameClashListPatternWhitespaceTest.elm

This `case` pattern has multiple `a` variables.

24|         [ a, a ] ->
              ^  ^
How can I know which one you want? Rename one of them!

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ErrorMessage2302NameClashListPatternWhitespaceTest exposing (main)
{-| The NAME CLASH report for a list pattern `[ a, a ]` prints 65532 spaces.
<https://github.com/elm/compiler/issues/2302>
The report should underline the two `a`s on the code line. Elm 0.19.1 prints the first caret,
then 65532 spaces before the second one.
Fixed in Elm 0.19.2.
-}
-- TAGS: elm19-bug-fix, error-message
-- COMPILE-ERROR: NAME CLASH with a readable code excerpt
-- CHECK: -- NAME CLASH -
-- CHECK-NOT: {{ {200}[ ]}}
import Html exposing (text)
failingCode : List () -> List ()
failingCode list =
case list of
[ a, a ] ->
list
_ ->
list
main =
text "done"