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

Switch expression single line broken when preceded by comment #1262

Closed
charliefoxtwo opened this issue May 18, 2024 · 0 comments · Fixed by #1263
Closed

Switch expression single line broken when preceded by comment #1262

charliefoxtwo opened this issue May 18, 2024 · 0 comments · Fixed by #1263
Milestone

Comments

@charliefoxtwo
Copy link

Version 0.28.2

Input:

public class ClassName {
    private static void Foo(Bar bar)
    {
        var y = bar switch
        {
            // comment
            Bar.A => 1,
            Bar.B => 2,
        };

        var z = bar switch
        {
            Bar.A => 1,
             // comment
            Bar.B => 2,
        };
    }

    enum Bar
    {
        A,
        B,
    }
}

Output:

public class ClassName
{
    private static void Foo(Bar bar)
    {
        var y = bar switch
        {
            // comment
            Bar.A
                => 1,
            Bar.B => 2,
        };

        var z = bar switch
        {
            Bar.A => 1,
            // comment
            Bar.B
                => 2,
        };
    }

    enum Bar
    {
        A,
        B,
    }
}

Expected behavior:
input should not be changed, and switch cases preceded by a comment should not be broken into separate lines.

@belav belav added this to the 0.29.0 milestone May 18, 2024
belav added a commit that referenced this issue May 18, 2024
shocklateboy92 added a commit that referenced this issue May 22, 2024
closes #1262

Co-authored-by: Lasath Fernando <devel@lasath.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants