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

operator== recursive #104

Open
sake402 opened this issue Dec 16, 2024 · 0 comments
Open

operator== recursive #104

sake402 opened this issue Dec 16, 2024 · 0 comments

Comments

@sake402
Copy link

sake402 commented Dec 16, 2024

Given the following static operator==

public static bool operator ==(HttpMethod left, HttpMethod right) =>
    left is null || right is null ?
         ReferenceEquals(left, right)
        : left.Equals(right);

The left is null is compiled as though it were left == null which causes the operator to invoke itself

                op_Equality: function (left, right) {
                    return System.Net.Http.HttpMethod.op_Equality(left, null) || System.Net.Http.HttpMethod.op_Equality(right, null) ? H5.referenceEquals(left, right) : left.equalsT(right);
                },

Changing the c# code to this unblock me for now

   public static bool operator ==(HttpMethod left, HttpMethod right) =>
       ReferenceEquals(left, null) || ReferenceEquals(right, null) ?
            ReferenceEquals(left, right)
           : left.Equals(right);
@sake402 sake402 changed the title Implicit operator recursive operator== recursive Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant