Open
Description
I need to pattern match an object inside a C# 8.0+ switch expression;
When the pattern is really big (ie. because of a lot of fields or long names), like the following:
public static int DummyMethodUsingSwitch(object foo) =>
foo switch
{
{ Foo: { Bar: "foo bar", Baz: true }, Supercalifragilisticexpialidocious: { Something: int smth, SomethingElse: int smthElse } } => smth + smthElse,
};
I tried formatting like this:
public static int DummyMethodUsingSwitch(object foo) =>
foo switch
{
{
Foo: { Bar: "foo bar", Baz: true },
Supercalifragilisticexpialidocious: { Something: int smth, SomethingElse: int smthElse }
} => smth + smthElse,
};
but SA1513 fires, suggesting the following fix:
public static int DummyMethodUsingSwitch(object foo) =>
foo switch
{
{
Foo: { Bar: "foo bar", Baz: true },
Supercalifragilisticexpialidocious: { Something: int smth, SomethingElse: int smthElse }
}
=> smth + smthElse,
};
which seems inconsistently spaced.
Is it a bug or intended behavior?