Elm Exactly
Results / elm-error-catalogue /

ErrorMessage2147NameClashWhitespaceTest

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#2147

The NAME CLASH report for a pattern that binds the same name twice prints tens of thousands
of spaces.

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

For `( T t, T t )` the report should underline the two `t`s. Elm 0.19.1 puts the second caret
tens of thousands of columns to the right, so the report contains a line of that many spaces.
The test fails on any run of 201 or more spaces in the output.

Fixed in Elm 0.19.2.

Results

elm-0.19.1

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

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

31|         ( T t, T t ) ->
                     ^                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

elm-0.19.2

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

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

30|         ( T t, T t ) ->
                ^    ^
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/ErrorMessage2147NameClashWhitespaceTest.elm

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

30|         ( T t, T t ) ->
                ^    ^
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/ErrorMessage2147NameClashWhitespaceTest.elm

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

30|         ( T t, T t ) ->
                ^    ^
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/ErrorMessage2147NameClashWhitespaceTest] in its title.

Source

The -- CHECK: lines give the expected output.

module ErrorMessage2147NameClashWhitespaceTest exposing (main)
{-| The NAME CLASH report for a pattern that binds the same name twice prints tens of thousands
of spaces.
<https://github.com/elm/compiler/issues/2147>
For `( T t, T t )` the report should underline the two `t`s. Elm 0.19.1 puts the second caret
tens of thousands of columns to the right, so the report contains a line of that many spaces.
The test fails on any run of 201 or more spaces in the output.
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)
type T
= T Int
break : T -> T -> T
break a b =
case ( a, b ) of
( T t, T t ) ->
T 0
main =
text "done"