elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Unused assignment, either in let assignments or unused args #281

Open mattiasw2 opened 5 years ago

mattiasw2 commented 5 years ago

In elm 0.19 you can easily write code like

  let
      model =
      model2 = { model | ...}
  in
     (model, ....)

where the last part should have referered to model2. No compiler warning is generated (or am I missing a flag?)

If the compiler would warn for unused variables like model2, the problem is trivial to detect.

Many language would not generate the warning if the variable starts with underscore, so the pattern

let _ = Debug.log "foo" bar in

would still work.

I notice there was some talk about this in 2015, but no specific issue created.