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

SwitchRexpression Pattern Matching is not breaking #214

Closed
belav opened this issue May 18, 2021 · 3 comments
Closed

SwitchRexpression Pattern Matching is not breaking #214

belav opened this issue May 18, 2021 · 3 comments
Labels

Comments

@belav
Copy link
Owner

belav commented May 18, 2021

The 3rd part of this is way past the printWidth but doesn't break.

var member = expression switch
{
    MemberExpression { Expression: Expression target, Member: MemberInfo propertyOrField } => new Member(
        expression,
        propertyOrField,
        target
    ),
    MethodCallExpression { Method: var instanceMethod, Object: Expression target } => new Member(
        expression,
        instanceMethod,
        target
    ),
    MethodCallExpression { Method: var extensionMethod, Arguments: { Count: > 0 } arguments } when extensionMethod.Has<ExtensionAttribute>() => new Member(
        expression,
        extensionMethod,
        arguments[0]
    ),
    _ => default
};
@belav belav added type:bug Something isn't working area:formatting labels May 18, 2021
@belav
Copy link
Owner Author

belav commented May 18, 2021

I believe the problem is more with the IsPattern, see

            if (
                !(node
                    is PrefixUnaryExpressionSyntax { Operand: ParenthesizedExpressionSyntax { Expression: IsPatternExpressionSyntax { Pattern: DeclarationPatternSyntax, } isPattern, }, } notExpression)
            ) {
                return;
            }

@belav
Copy link
Owner Author

belav commented Jul 19, 2021

This will hopefully be resolved in #154

@belav
Copy link
Owner Author

belav commented Aug 4, 2021

The original issue was resolved with #382

@belav belav closed this as completed Aug 4, 2021
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

1 participant