fix: strictly check operator overload ambiguity#2762
fix: strictly check operator overload ambiguity#2762HerrCai0907 merged 1 commit intoAssemblyScript:mainfrom
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 == bandb == ashould run the same function and get the same result in semantic level. Allowing ambiguity is bug prone.fixes: #2761