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: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@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: -------