mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Improve error messages for opUnary
(#20801)
This commit is contained in:
parent
06e0096aca
commit
06d0cfe2ba
5 changed files with 192 additions and 173 deletions
|
@ -30,7 +30,12 @@ Error: `app.bar` called with argument types `(string)` matches multiple overload
|
|||
*/
|
||||
---
|
||||
|
||||
When there's no index / slice operator overload found for a type, a new supplemental message suggests where to implement it.
|
||||
Error messages related to operator overloading have been improved.
|
||||
When the related template functions (`opUnary`, `opBinary`, `opBinaryRight`, `opOpAssign`, `opIndex`, `opSlice`)
|
||||
are missing, a suggestion to implement them is given.
|
||||
|
||||
When they do exist but fail to instantiate, the error from instantiation is shown.
|
||||
There's no longer a need to manually e.g. rewrite `s + 1` to `s.opBinary!"+"(1)` to diagnose the error.
|
||||
|
||||
---
|
||||
struct S {}
|
||||
|
@ -53,9 +58,6 @@ app.d(1): perhaps define `auto opSlice(int lower, string upper) {}` for `
|
|||
*/
|
||||
---
|
||||
|
||||
When overloading binary operators, and `opBinary`, `opBinaryRight` or `opOpAssign` is missing / fails to instantiate,
|
||||
the error message now points out the problem:
|
||||
|
||||
---
|
||||
struct Str {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue