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

Find All References doesn't find usages of checked user-defined operators #60216

Closed
AlekseyTs opened this issue Mar 16, 2022 · 0 comments · Fixed by #60698
Closed

Find All References doesn't find usages of checked user-defined operators #60216

AlekseyTs opened this issue Mar 16, 2022 · 0 comments · Fixed by #60698
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Feature - CheckedUserDefinedOperators IDE-Navigation Navigation and search Navigation-FAR Find all references
Milestone

Comments

@AlekseyTs
Copy link
Contributor

class Program
{
    static void Main()
    {
        var x = new C();
        var y = new C();

        var z1 = -x;

        var z2 = x + y;

        string z3 = (string)x;

        ;

        checked
        {
            z1 = -y;
            z2 = y + x;
            z3 = (string)x;

            ;
        }

        System.Action a1 = D;
        System.Action a2 = D;

        var b = ReferenceEquals(a1, a2);
    }

    static void D() { }
}

class C
{
    /// <summary>
    /// <see cref="operator +(C, C)"/>
    /// <see cref="operator -(C)"/>
    /// <see cref="explicit operator string(C)"/>
    /// <see cref="operator checked +(C, C)"/>
    /// <see cref="operator checked -(C)"/>
    /// <see cref="explicit operator checked string(C)"/>
    /// </summary>
    public string F;

    public static C operator checked -(C x) => new C { F = "checked -" };
    public static C operator -(C x) => new C { F = "regular -" };

    public static C operator checked +(C x, C y) => new C { F = "checked +" };
    public static C operator +(C x, C y) => new C { F = "regular +" };

    public static explicit operator checked string(C x) => "checked string";

    public static explicit operator string(C y) => "regular string";
}
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Mar 16, 2022
@jinujoseph jinujoseph removed the untriaged Issues and PRs which have not yet been triaged by a lead label Mar 22, 2022
@jinujoseph jinujoseph added this to the 17.3 milestone Mar 22, 2022
@jinujoseph jinujoseph added IDE-Navigation Navigation and search Concept-Continuous Improvement Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality and removed Concept-Continuous Improvement labels Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Feature - CheckedUserDefinedOperators IDE-Navigation Navigation and search Navigation-FAR Find all references
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants