Skip to content

Assert failing in LocalRewriter.CollectAndVisitConcatArguments #80254

@jjonescz

Description

@jjonescz

Version Used: de9d72e

Steps to Reproduce:

.NET Lab

[Fact]
public void CompoundAssignment()
{
    var source = """
        var c = new C();
        c.P += "a" + c.P;
        System.Console.WriteLine(c.P);

        class C
        {
            public string P { get; set; } = "x";
        }
        """;
    CompileAndVerify(source, expectedOutput: "xax").VerifyDiagnostics();
}

This assert fails:

Debug.Assert(visitedCompoundAssignmentLeftRead is
not (BoundCall or BoundConversion { ConversionKind: ConversionKind.Boxing, Type.SpecialType: SpecialType.System_Object, Operand.Type.SpecialType: SpecialType.System_Char })
and { ConstantValueOpt: null });

The assert was introduced in #76955.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions