Skip to content

Invalid blank line being added with lambda returning collection expression #1306

@ShawnTheBeachy

Description

@ShawnTheBeachy

Input:

public sealed class Demo
{
    private void Foo()
    {
        var sub = Substitute.For<IFoo>();
        sub.Bar()
            .Returns(_ =>
                [
                    Guid.Parse("90a34545-5030-4251-8e5b-355c2d1e322e"),
                    Guid.Parse("30c0932b-4563-4a46-8577-3c285addfa69")
                ]
            );
    }

    private interface IFoo
    {
        IReadOnlyList<Guid> Bar();
    }
}

Output:

public sealed class Demo
{
    private void Foo()
    {
        var sub = Substitute.For<IFoo>();
        sub.Bar()
            .Returns(_ =>

                [
                    Guid.Parse("90a34545-5030-4251-8e5b-355c2d1e322e"),
                    Guid.Parse("30c0932b-4563-4a46-8577-3c285addfa69")
                ]
            );
    }

    private interface IFoo
    {
        IReadOnlyList<Guid> Bar();
    }
}

Expected behavior:
The blank line on line 8 should not be there.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions