-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
fix: strictly check operator overload ambiguity #2762
fix: strictly check operator overload ambiguity #2762
Conversation
bf4335c
to
64425ab
Compare
Perhaps |
Maybe |
|
ping @dcodeIO @CountBleck |
@CountBleck @dcodeIO Could I land it now? |
I can't say all that much about the contents of the PR. @dcodeIO knows what's best. To upgrade the minor version, you need the |
03511df
to
67765fa
Compare
friendly ping @dcodeIO |
Could this become a warning that mentions which overload has been picked by the compiler? Similar to my prior comment:
Or do you think that there are good reasons to make it an error and hence a breaking change? |
I think we should forbidden this behavior because:
|
Given that operator overloads are merely an internal mechanism, primarily for string implementation, and not recommended to be used for anything custom anyway as these won't typecheck, I guess it's fine to check these strictly and error otherwise. More generally, I'd probably even prefer that we limit their use, and encouraged the use of |
Agree. |
67765fa
to
ac2de3a
Compare
I treat it as a |
operator overloads are merely an internal mechanism, primarily for string implementation, operator overload can support to compare user-defined class, but it need to be limited.
a == b
andb == a
should run the same function and get the same result in semantic level. Allowing ambiguity is bug prone.fixes: #2761