Add changelog entry for error message changes (#20753)

Co-authored-by: Dennis Korpel <dennis@sarc.nl>
This commit is contained in:
Dennis 2025-01-21 22:01:00 +01:00 committed by GitHub
parent ff2543f768
commit 12c1363f86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,45 @@
Many error messages have changed
Some changes have been made without being associated to a reported issue:
Error messages for `@safe` violations now consistently mention they are related to `@safe` functions (or default functions with `-preview=safer`).
In general, function attributes that failed to infer have a more compact error message:
---
/*
BEFORE:
app.d(8): Error: function `attributediagnostic_nothrow.gc1` is not `nothrow`
app.d(2): which wasn't inferred `nothrow` because of:
app.d(2): `object.Exception` is thrown but not caught
AFTER:
app.d(8): Error: function `attributediagnostic_nothrow.gc1` is not `nothrow`
app.d(2): and `object.Exception` being thrown but not caught makes it fail to infer `nothrow`
*/
---
Match levels are now mentioned on ambiguous overloads: [#20637](https://github.com/dlang/dmd/pull/20637)
---
/*
BEFORE:
Error: `app.bar` called with argument types `(string)` matches both:
AFTER:
Error: `app.bar` called with argument types `(string)` matches multiple overloads after implicit conversions:
*/
---
When there's no operator overload found for a type, a new supplemental message points to the declaration.
---
/*
app.d(8): Error: no `[]` operator overload for type `U`
app.d(6): `app.U` declared here
*/
---
Furthermore:
- D1 operator overloading functions (`opAdd`, `opDot`) are completely removed and no longer mentioned in error messages specifically.
- Class allocators (`auto new() {}`) are not only a semantic error, but no longer being parsed