jfmengels / elm-review-simplify

Provides elm-review rules to simplify your Elm code
https://package.elm-lang.org/packages/jfmengels/elm-review-simplify/latest/
BSD 3-Clause "New" or "Revised" License
20 stars 9 forks source link

Merging of let..in can lead to naming collisions #313

Open jfmengels opened 1 week ago

jfmengels commented 1 week ago

SSCCE

value =
  let
    a name = name
  in
  let
    name = "str"
  in
  a name

Currently, this gets simplified to the following, which introduces a naming collision error from the compiler.

value =
  let
    a name = name

    name = "str"
  in
  a name

I think the solution would be to check that there will be no collisions, but this is quite a bit of analysis compared to what is done today. I wonder if there's a smart way of doing it :thinking: