Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter should not remove all whitespaces between invalid tokens #35240

Closed
lochana-chathura opened this issue Feb 25, 2022 · 1 comment · Fixed by #41417
Closed

Formatter should not remove all whitespaces between invalid tokens #35240

lochana-chathura opened this issue Feb 25, 2022 · 1 comment · Fixed by #41417
Assignees
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

Comments

@lochana-chathura
Copy link
Member

lochana-chathura commented Feb 25, 2022

Description:
$subject as the formatting would make the code different than it was before.

Consider the following samples.
Original Code:
Screenshot from 2022-02-25 13-43-42

After Formatting:
Screenshot from 2022-02-25 13-44-03

As you can see after formatting instead of where keyword and i identifier now we have wherei 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

After Formatting:
Screenshot from 2022-02-25 14-12-32

Code Snippets (click to expand)
public function main() {
    var c = from var i in 0 ... 5
        select i
        where i % 2 != 0;
}
public function main() {
    map<string> v = {};
    match v {
        {...var c, var c} => {
            io:println(c);
        }
        _ => {

        }
    }
}

Affected Versions:
2201.0.0

Copy link

github-actions bot commented Jan 9, 2024

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@lochana-chathura lochana-chathura added this to the 2201.8.5 milestone Jan 9, 2024
@lochana-chathura lochana-chathura added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Jan 9, 2024
@lochana-chathura lochana-chathura modified the milestones: 2201.8.5, 2201.9.0 Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants