elm-format
elm-format copied to clipboard
adjacent let blocks should be joined
let
a = 1
in
let
b = 2
in
a + b
should merge the two blocks of definitions. Are there any cases where this changes the meaning of the code?
This might be an issue in Elm <0.19
where shadowing is allowed.
Valid Elm 0.18
:
let a = 1
in
let a = 2
in a
Not valid Elm:
let a = 1
a = 2
in a
We get the following error message in 0.18
:
-- DUPLICATE DEFINITION ----------------------------------------------- Test.elm
There are multiple values named `a` in this let-expression.
11| a =
^
Search through this let-expression, find all the values named `a`, and give each
of them a unique name.
Detected errors in 1 module.
Perhaps it's as simple as just checking if the adjacent blocks are disjoint (have no shared variable names).
Working on this (: