Repository: dotnet/roslyn
File: src/Analyzers/CSharp/Tests/RemoveUnnecessaryParentheses/RemoveUnnecessaryExpressionParenthesesTests.cs (C#)

Code before:
            {
                void M()
                {
                    if (true is default(bool))
                    {
                    }
                }
            }
            """, offeredWhenRequireForClarityIsEnabled: true);

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/25554")]
    public Task TestConstantPatternExpression_RequiredForPrecedence()
        => TestMissingAsync(
            """
            class C
            {
                void M(string s)
                {
                    if (true is $$(true == true))
                    {
                    }
                }
            }
            """, new TestParameters(options: RemoveAllUnnecessaryParentheses));

    [Fact]
    public Task TestWhenClauseWithNullableIndexing_RequiredForParsing()
        => TestMissingAsync(
            """
            class C
            {
                public void M(C[] x, bool a)
                {
                    switch ("")
                    {
                        case "" when $$(a || x?[0]):
                        {
                            break;
                        }
                    }
                }

                public static implicit operator bool(C? c) => true;
            }
            """, new TestParameters(options: RemoveAllUnnecessaryParentheses));

    [Fact]
    public Task TestWhenClauseWithNullableIndexing_AndOperator()
        => TestMissingAsync(
            """
            class C

Review comment (suggestion):
@copilot all new tests ahould have a WorkItem like so `[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80938")]`

Code after:
            {
                void M()
                {
                    if (true is default(bool))
                    {
                    }
                }
            }
            """, offeredWhenRequireForClarityIsEnabled: true);

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/25554")]
    public Task TestConstantPatternExpression_RequiredForPrecedence()
        => TestMissingAsync(
            """
            class C
            {
                void M(string s)
                {
                    if (true is $$(true == true))
                    {
                    }
                }
            }
            """, new TestParameters(options: RemoveAllUnnecessaryParentheses));

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80938")]
    public Task TestWhenClauseWithNullableIndexing_RequiredForParsing()
        => TestMissingAsync(
            """
            class C
            {
                public void M(C[] x, bool a)
                {
                    switch ("")
                    {
                        case "" when $$(a || x?[0]):
                        {
                            break;
                        }
                    }
                }

                public static implicit operator bool(C? c) => true;
            }
            """, new TestParameters(options: RemoveAllUnnecessaryParentheses));

    [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80938")]
    public Task TestWhenClauseWithNullableIndexing_AndOperator()
        => TestMissingAsync(
            """
            class C