Skip to content

RCS1166 doesn't work if first operand is null #1698

@cbersch

Description

@cbersch

The following code should both raise an RCS1166 diagnostic, but the null == a isn't recognized. Tested with 4.14.1

public static class Class1
{
    public static bool Correct(ImmutableArray<int> a)
    {
        return a == null;
    }

    public static bool Wrong(ImmutableArray<int> a)
    {
        return null == a;
    }
}
Image

Until now I couldn't reproduce this with any other custom type, which wouldn't also trigger CS8073.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions