November 05, 2013 [Issue 11444] New: Better error messages for Phobos ranges used without bang ! | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=11444 Summary: Better error messages for Phobos ranges used without bang ! Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-11-05 07:39:06 PST --- This is wrong code: import std.stdio, std.algorithm; void main() { "123".map(d => d - '0').writeln; } dmd 2.064beta gives the error messages: test.d(3): Error: template std.algorithm.map does not match any function template declaration. Candidates are: ...\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(398): std.algorithm.map(fun...) if (fun.length >= 1) test.d(3): Error: template std.algorithm.map(fun...) if (fun.length >= 1) cannot deduce template function from argument types !()(string, void) The mistake is in the map, it should be "map!(...)". Range-based code that uses map, filter and other similar functions is becoming common, so I suggest to add some euristics to the D front-end to generate better error messages for common Phobos templates that are used without the "!", something like: test.d(3): Error: template std.algorithm.map does not match any function template. Did you miss a "!"? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 05, 2013 [Issue 11444] Better error messages for Phobos ranges used without bang ! | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | https://d.puremagic.com/issues/show_bug.cgi?id=11444 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich@gmail.com Resolution| |DUPLICATE --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-11-05 13:21:53 PST --- *** This issue has been marked as a duplicate of issue 9179 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation