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

Formatting named list patterns removes its name leaving code that doesn't compile #876

Closed
Dragemil opened this issue Apr 25, 2023 · 2 comments
Labels
Milestone

Comments

@Dragemil
Copy link

Csharpier version: 0.23.0.

Before formatting:

public static int ListOperation(List<int> list)
{
    return list switch
    {
        [var elem] => elem * elem,
        [] => 0,
        [..] elems => elems.Sum(e => e + e),
    };
}

After formatting:

public static int ListOperation(List<int> list)
{
    return list switch
    {
        [var elem] => elem * elem,
        [] => 0,
        [..] => elems.Sum(e => e + e),
    };
}

List pattern name elems disappears leaving code that doesn't compile.

@belav belav added this to the 0.24.0 milestone Apr 25, 2023
belav added a commit that referenced this issue Apr 26, 2023
@belav
Copy link
Owner

belav commented Apr 26, 2023

I'll get the fix for this out in a new release shortly, thanks for reporting it!

@belav belav closed this as completed in d896f6c Apr 26, 2023
@Dragemil
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants