Confusing formatting on unrelated cascades
The formatter produces this output:
main() {
foo.bar.create(Thing()
..a = b
..c = d)
..method().chain((_) => lambda);
}
Note that the last cascade (..method()) is not on the same receiver as the previous ones even though it's indented the same.
I spent some time looking into this, but wasn't able to come up with a fix that didn't push a lot of other formatting around in generally worse ways. The main problem is that this interacts poorly with the special rule that cascades indent deeper than a preceding method chain even though technically the method chain is a subexpression:
object
.method()
.method()
..cascade()
..cascade();
We can possibly lose that special rule. I ran it on a corpus and I can't honestly say I think the rule carries its weight. However, a side effect of that is that a lot of expressions preceding cascades go from +2 indentation to +4 because now they get normal expression indentation.
I'm not sure if that's a net win, so sitting on this for now.
The forthcoming tall style moves ) to the next line when an argument list which happens to resolve the weird formatting here too. With the new style, you get:
main() {
foo.bar.create(
Thing()
..a = b
..c = d,
)..method().chain((_) => lambda);
}