Formatter should not remove all whitespaces between invalid tokens #35240
Labels
Area/Formatting
Priority/High
Reason/EngineeringMistake
The issue occurred due to a mistake made in the past.
Team/CompilerFETools
Semantic API, Formatter, Shell
Type/Bug
Milestone
Description:
$subject as the formatting would make the code different than it was before.
Consider the following samples.
![Screenshot from 2022-02-25 13-43-42](https://user-images.githubusercontent.com/39232462/155680585-45de1396-eab1-4fd1-978c-2dd4f47873ae.png)
Original Code:
After Formatting:
![Screenshot from 2022-02-25 13-44-03](https://user-images.githubusercontent.com/39232462/155680606-ef9ec2c3-ef2f-4263-8b72-fde150f086ec.png)
As you can see after formatting instead of
where
keyword andi
identifier now we havewherei
identifier.Basically removing all whitespaces makes the code tokenized differently than it was before.
Another Sample (click to expand)
Original Code:
![Screenshot from 2022-02-25 14-12-08](https://user-images.githubusercontent.com/39232462/155683610-5108aa37-f433-4b92-b5a5-307efd409b87.png)
After Formatting:
![Screenshot from 2022-02-25 14-12-32](https://user-images.githubusercontent.com/39232462/155683668-c2a1e71c-13e8-4c41-a8f8-5189a38ae1a6.png)
Code Snippets (click to expand)
Affected Versions:
2201.0.0
The text was updated successfully, but these errors were encountered: