Fixes the erroneous error for notations like [{ }], as described in the issue.
The }] case was already handled by https://github.com/pinterest/ktlint/pull/596, but the [{ notation needed some additional fix. There was a special exception for ({, and since this one is similar, I added the case for LBRACKET too.
Two tests were added, one to check that notations like [{ a -> a }], [{ }], and [{}] are allowed, and a second one to check that [ { } ] is formatted correctly.
Fixes https://github.com/pinterest/ktlint/issues/2675
Description
Fixes the erroneous error for notations like
[{ }]
, as described in the issue. The}]
case was already handled by https://github.com/pinterest/ktlint/pull/596, but the[{
notation needed some additional fix. There was a special exception for({
, and since this one is similar, I added the case for LBRACKET too.Two tests were added, one to check that notations like
[{ a -> a }]
,[{ }]
, and[{}]
are allowed, and a second one to check that[ { } ]
is formatted correctly.