Bug 11813 – Improve IFTI error diagnostic

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-24T18:39:00Z
Last change time
2013-12-30T20:02:04Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-12-24T18:39:45Z
This code: void foo()() if (true) {} // line 1 void main() { foo(1); } // line 2 Prints: test.d(2): Error: template test.foo does not match any function template declaration. Candidates are: test.d(1): test.foo()() if (true) test.d(2): Error: template test.foo()() if (true) cannot deduce template function from argument types !()(int) I think the diagnostic error output contains following issues: 1. Full signature of the template 'foo' is printed twice. If the template constraint is big, the redundancy would become more problematic. 2. One IFTI error prints two error lines - "does not match ..." and "cannot deduce ...". In principle one error should be associated with one error line. To fix the issues, I'd propose following output. test.d(2): Error: template test.foo cannot deduce function from argument types !()(int), candidates are: test.d(1): test.foo()() if (true) Advantages: a. The error "template test.foo cannot deduce ..." shows the full qualified name of candidate template overload set and function argument types. b. Follwing "candidates are:" and supplemental error lines show the detail of candidate overloads.
Comment #1 by k.hara.pg — 2013-12-24T19:50:46Z
Comment #2 by github-bugzilla — 2013-12-30T17:22:12Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/696dfbf44d5d287aa60a429d47ff367daaae1fa6 fix Issue 11813 - Improve IFTI error diagnostic https://github.com/D-Programming-Language/dmd/commit/391a3d2186ccd612bc4ede603c820b68a7f9fb63 Merge pull request #3020 from 9rnsr/faildiag Issue 11813 & 11814 - improve diagnostic messages on IFTI failure
Comment #3 by bearophile_hugs — 2013-12-30T20:02:04Z
This reduces the noise of the error messages, it's a nice improvement.