mirror of
https://github.com/vlang/v.git
synced 2025-09-14 09:56:16 -04:00
docs: document the return type restrictions for operator overloading (#20529)
This commit is contained in:
parent
cb224076ec
commit
acf75c71da
@ -6191,6 +6191,8 @@ To improve safety and maintainability, operator overloading is limited.
|
||||
|
||||
- When overriding `<` and `==`, the return type must be strictly `bool`.
|
||||
- Both arguments must have the same type (just like with all operators in V).
|
||||
- Overloaded operators have to return the same type as the argument
|
||||
(the exceptions are `<` and `==`).
|
||||
|
||||
#### Other restrictions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user