[Issue 6728] New: Better error message with map!{...}()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 25 11:06:55 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6728

           Summary: Better error message with map!{...}()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-09-25 11:06:22 PDT ---
A low-priority enhancement request.
This is wrong D2 code:


import std.algorithm;
void main() {
    auto r = map!{ a * a }([1, 2]);
}


DMD 2.056head gives four error messages:

test.d(3): template argument expected following !
test.d(3): semicolon expected following auto declaration, not '{'
test.d(3): found '}' when expecting ';' following statement
test.d(4): found 'EOF' when expecting '}' following compound statement


It contains a common mistake:
map!{...}()

instead of:
map!q{...}()

Given how common such mistake is in my code, I'd like the compiler to recognize
it and show (if possible) a single and more readable error message.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list