Right now when a punned variable is unused you always get the same hint on how to ignore it (which is prepend a _ to the var name). This is not really precise for punned variables:
let Wibble(arg:, arg1:) = todo
// ^^^^^ Warning: unused, you can ignore it with an underscore `_arg1`
If one were to blindly apply the compiler's suggestion here they would get a compilation error:
let Wibble(arg:, _arg1) = todo
// ^^^^^ Error: unlabelled arg after labelled one!
// Or even:
let Wibble(arg:, _arg1:) = todo
// ^ Error: I was not expecting this!
Which could be confusing for a newcomer. Once we improve unused detection using a call graph https://github.com/gleam-lang/gleam/issues/2634 we could be more precise and change the suggestion for variables brought into scope through punning and provide a valid suggestion like this:
let Wibble(arg:, arg1:) = todo
// ^^^^^ Warning: unused, you can ignore it with an underscore `arg1: _`
Right now when a punned variable is unused you always get the same hint on how to ignore it (which is prepend a
_
to the var name). This is not really precise for punned variables:If one were to blindly apply the compiler's suggestion here they would get a compilation error:
Which could be confusing for a newcomer. Once we improve unused detection using a call graph https://github.com/gleam-lang/gleam/issues/2634 we could be more precise and change the suggestion for variables brought into scope through punning and provide a valid suggestion like this: