elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 661 forks source link

Compiler outputs pages of whitespace in middle of 'name clash' error report #2147

Open coreygirard opened 3 years ago

coreygirard commented 3 years ago

Quick Summary: The compiler outputs pages of whitespace in the middle of reporting a name clash error

SSCCE

Source

type T
    = T Int

break : T -> T -> T
break a b =
    case ( a, b ) of
        ( T t, T t ) ->
            T 0

Expected output

Detected problems in 1 module.
-- NAME CLASH ------------------------------------------- src/Tree.elm

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

123|         ( T t, T t ) ->
                 ^    ^
How can I know which one you want? Rename one of them!

Received output

Detected problems in 1 module.
-- NAME CLASH ------------------------------------------- src/Tree.elm

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

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

[literally tens of thousands of whitespace characters]

      ^
How can I know which one you want? Rename one of them!
evancz commented 3 years ago

Very strange! Great SSCCE. Will circle back to this for the next compiler release.

coreygirard commented 8 months ago

Just came across similar behavior in simpler contexts:

f =
    \t t -> 0
Detected problems in 1 module.
-- NAME CLASH -------------------------------------- src/Filename.elm

This anonymous function has multiple `t` arguments.

234|     \t t -> 0
            ^

[tens of thousands of whitespace characters]

         ^
How can I know which one you want? Rename one of them!

f t t = 0
Detected problems in 1 module.
-- NAME CLASH -------------------------------------- src/Filename.elm

The `f` function has multiple `t` arguments.

233| f t t =
         ^

[tens of thousands of whitespace characters]

         ^
How can I know which one you want? Rename one of them!