The alignment fix introduced by https://reviews.llvm.org/D104388 caused a regression whereby formatting of code that follows the lambda block is incorrect i.e. separate expressions are put on the same line.
For example:
public void Test() { while (true) { preBindEnumerators.RemoveAll(enumerator => !enumerator.MoveNext()); CodeThatFollowsLambda(); IsWellAligned(); }
will be formatted as:
public void Test() { while (true) { preBindEnumerators.RemoveAll(enumerator => !enumerator.MoveNext()); CodeThatFollowsLambda(); IsWellAligned(); }
The problem is that the "Fat arrow" token parsing inside the parseParens() function uses parseStructuralElement() which does not like to be called inside the parenthesis. It seems that code that follows is considered part of the parenthesis block.
As a fix, parseStructuralElement parser inside the parseParens() was replaced with parseChildBlock() if the following token was a "left brace" and nextToken() otherwise. Added few new unit tests to demonstrate the regressions.
To keep the naming consistent.